Day 3 - Get rid of a warning

To avoid a warning like the following:

warning: parser/current is loading parser/ruby30, which recognizes
warning: 3.0.1-compliant syntax, but you are running 3.0.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

Make sure to keep your version of the gem parser (a dependency of Rubocop among others) in lockstep with your version of Ruby:

# Gemfile
ruby "3.0.0"
gem "parser", "3.0.0"
1 Like

I went with a very low hanging fruit today and removed “throws Exception” from tests that don’t throw anything :slight_smile:

Took longer than 20 minutes but I removed some warnings from my tests about datetimes without timezones when timezone support is active. I definitely have cleaner looking tests and I understood a minor error from a past bug I was fixing

Wow. Warning shame. No seriously this was really helpful in actually looking into the off-and-on warning that’s been coming up in Slack, and oh was it a problem! Not fixable in 30 minutes, but has justified a chunk of work in the next sprint.

fixed a npm vulnerability warning :+1:

fixed a couple of warnings related to our build process plus npm vulnerability warnings (thanks for the inspiration @Jannie)

I found 2 warnings doing a fresh yarn install on my project

warning " > webpack-dev-server@3.10.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".

I spend some minutes reading about peer dependencies and I found these links useful

I did the webpack upgrade and the warnings are gone

Could not complete this up but picked an error log, this was coming for more than 4K times in every hour. Started working on it, understanding why this is happening, hopefully will be able to dig deep and resolve this in coming few days.

Hi there! Great advice today, just ran npm audit fix on a few projects :slight_smile:

Thanks!

Deprecation warnings in Ruby code are not common in my project, as we treat them as exception and even track them in the exception notifier. But, well, javascript… I finally fixed some warnings that happen during development.

1 Like

I found this Deprecation warning in our logs:

Deprecation notice: Discourse.base_uri is deprecated, use Discourse.base_path instead

Turns outs it was coming from a fork of a plugin that we have in a private repo that hadn’t been updated in awhile, but has been flooding our logs for quite some time now. I created a PR to that repo with the necessary change.

1 Like

We had a warning of this type during the app boot phase:

WARN -- : Creating scope :my_scope. Overwriting existing method MyModel.my_scope

We used to redefine the scope in a decorator by naively calling #scope again on the class.

Using the prepend ClassMethods pattern instead fixes the issue, and brings the benefit of letting us reuse the original implementation using #super (we simply need to override an ORDER BY after all…):

class MyModel
  scope :some_scope, -> { order("my_model_table.column_1 ASC") }
end

module MyModelDecorator
  extend ActiveSupport::Concern

  def self.prepended(base)
    base.singleton_class.prepend ClassMethods
  end

  module ClassMethods
    def some_scope
      super.reorder("my_model_table.column_1 ASC, my_model_table.column_2 DESC")
    end
  end

  ::MyModel.prepend self
end

I think because our app is such a simple PHP / CodeIgniter app, there wasn’t too many warnings period. BUT I did notice when deploying a new set up, it was missing an optional config file I just keep manually making… and it would cause an error. So now i have it checked into the codebase as a template and updated the readme file!

Python / Pandas

FutureWarning: 'argmin' is deprecated, use 'idxmin' instead. The behavior of 'argmin'
will be corrected to return the positional minimum in the future.
Use 'series.values.argmin' to get the position of the minimum now.

So I did. A lot. :grinning:

Done!

Not much on this one other than the ruby 2.7 Capturing the given block using Proc.new warnings in gems.

Checked to see if they’d be updated but alas, not yet.

Ran npm audit and fixed two security warnings in my package-lock.json. Then on a whim I started looking through other dependencies and found 3 unused ones that I was able to delete. This was on a relatively new codebase with only a dozen or so dependencies; code get stale fast!

Huh. Not fixable in 20 minutes, but this day pushed me forward in solving it.

I decided to take this opportunity to tackle a warning that has been spamming my alerting channel for a while, however it was harder than I thought and it’s going to take a lot longer than 20 minutes for me to resolve it. However, now I know that it’s a big task that needs the proper time allocated to fixing it

I know, I fell off - it has been quite some time, but we had the chance to do some needed upgrades for our app so I took a slight detour. I’m back, with a PR for day 3 that involved swapping the fog gem to fog-aws so we could get rid of post-install warnings and reduce unneeded dependencies.