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

Unexpected change to Style/Copyright from #12804 #12889

Closed
stoivo opened this issue May 7, 2024 · 4 comments
Closed

Unexpected change to Style/Copyright from #12804 #12889

stoivo opened this issue May 7, 2024 · 4 comments

Comments

@stoivo
Copy link
Contributor

stoivo commented May 7, 2024

Hi, I upgraded rubopcop and started to receive a warning which I didn't expect.

An AutocorrectNotice must be defined in your RuboCop config (from file: path.rb)

This comes from Style/Copyright. In #12804 there is a change from calling verify_autocorrect_notice! in add_offense block to to inside on_new_investigation. I don't think Style/Copyright is enabled in our application, by default it is disabled. Maybe on_new_investigation shouldn't be called when the cop isn't enabled.

Havn't tested if its this pull request but I am quite confident. I don't get the warning in version rubocop version 1.62.1, but I do for 1.63.0.

$ bundle exec rubocop -V
1.63.0 (using Parser 3.3.1.0, rubocop-ast 1.31.3, running on ruby 3.2.1) [arm64-darwin22]
  - rubocop-capybara 2.20.0
  - rubocop-factory_bot 2.25.1
  - rubocop-performance 1.21.0
  - rubocop-rails 2.24.1
  - rubocop-rspec 2.29.2
  - rubocop-rspec_rails 2.28.3
@stoivo
Copy link
Contributor Author

stoivo commented May 7, 2024

I tried to remove all the extension and I still get the warning

$ bundle exec rubocop -V
1.63.0 (using Parser 3.3.1.0, rubocop-ast 1.31.3, running on ruby 3.2.1) [arm64-darwin22]

@koic
Copy link
Member

koic commented May 7, 2024

Does the issue still reproduce with the latest RuboCop 1.63.4? If so, can you share a reproducible .rubocop.yml.

@stoivo
Copy link
Contributor Author

stoivo commented May 10, 2024

I wanted to create a minimal reproduction example and found out that we have this code

# rubocop: disable Style
Transaction.new do
  ....
end
# rubocop: enable Style

So the seam that it was a user error after all. Sorry.

@koic
Copy link
Member

koic commented May 10, 2024

The warning message in the title appears when Style/Copyright cop is enabled, but the AutocorrectNotice parameter is not set to .rubocop.yml, and a copyright notice cannot be found in the inspected source code. Therefore, the warning message is unexpected to occur when Style/Copyright cop is disabled. If the issue persists, please provide additional information. Thank you.

@koic koic closed this as completed May 10, 2024
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

No branches or pull requests

2 participants