Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI and local ruby keyword args YAMLs don't match #48

Open
snehaso opened this issue Jul 21, 2020 · 1 comment · May be fixed by #60
Open

CI and local ruby keyword args YAMLs don't match #48

snehaso opened this issue Jul 21, 2020 · 1 comment · May be fixed by #60

Comments

@snehaso
Copy link

snehaso commented Jul 21, 2020

Hi

I'm using deprecation-toolkit to capture ruby 2.7 warnings in our codebase. We'd disabled them earlier but want to enable again.

I recorded warnings using CIRecordHelper but I've hit a issue where the ruby code and gem paths in warnings are different on CI and developer environment. How do I handle this?

On local,

---
test_the_banking_inline_form_add_an_attachment_to_an_explanation:
- |
  DEPRECATION WARNING: /Users/snehasomwanshi/dev/accouting/app/uploaders/attachment_attachment_uploader.rb:136: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /Users/snehasomwanshi/.gem/ruby/2.7.1/gems/shrine-3.2.1/lib/shrine/plugins/store_dimensions.rb:75: warning: The called method `extract_metadata' is defined here
- |
  DEPRECATION WARNING: /Users/snehasomwanshi/dev/accouting/app/uploaders/attachment_attachment_uploader.rb:124: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /Users/snehasomwanshi/.gem/ruby/2.7.1/gems/shrine-3.2.1/lib/shrine.rb:222: warning: The called method `generate_location' is defined here

On CI,

  ---
test_the_banking_inline_form_adding_a_new_explanation:
- |
  DEPRECATION WARNING: /home/ubuntu/workspace/fac/accounting/app/uploaders/attachment_attachment_uploader.rb:136: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /home/ubuntu/.gem/ruby/2.7.1/gems/shrine-3.2.1/lib/shrine/plugins/store_dimensions.rb:75: warning: The called method `extract_metadata' is defined here
- |
  DEPRECATION WARNING: /home/ubuntu/workspace/fac/accounting/app/uploaders/attachment_attachment_uploader.rb:124: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /home/ubuntu/.gem/ruby/2.7.1/gems/shrine-3.2.1/lib/shrine.rb:222: warning: The called method `generate_location' is defined here

Does this mean that a developer can not record a new warning locally? How do I handle this?

@bradparker
Copy link

@snehaso in case this is still useful to you: while spiking out using deprecation toolkit I ran into this issue and worked around it by overriding deprecations_without_stacktrace. So, not a long term solution but as I said: just in case it's useful. Here's most of the initializer we were thinking of using:

DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [
  /Using the last argument as keyword parameters is deprecated/,
  /Capturing the given block using Proc.new is deprecated/,
]

module DeprecationToolkit
  class Collector
    alias old_deprecations_without_stacktrace deprecations_without_stacktrace

    def deprecations_without_stacktrace
      old_deprecations_without_stacktrace.map do |deprecation|
        deprecation
          .sub(/^DEPRECATION WARNING: \/.* warning: /, "DEPRECATION WARNING: ")
          .sub(/\/.* is defined here$/, "")
      end
    end
  end
end

@sambostock sambostock linked a pull request Mar 11, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants