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

Upgrade RuboCop to 1.69 + enable new cops #984

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Dec 7, 2024

This picks up from #981 so that needs to get merged first

  • Upgrade to RuboCop 1.69.1
  • Enable Ruby 3.0 by default for chefstyle and Ruby 2.6 by default for cookstyle (allows upgrades from old clients)
  • Fix deprecation warnings from some cops that inherited from Cop instead of Base
  • Correct style issues within cookstyle itself
  • Enable new cops available between 1.25 -> 1.69 which made sense
  • Update monkeypatch code to work with modern RuboCop

tas50 added 15 commits December 1, 2024 14:41
These were renamed in rubocop/rubocop#7460

Signed-off-by: Tim Smith <[email protected]>
Signed-off-by: Tim Smith <[email protected]>
This one was partially updated at some point, but is not right:

See https://github.com/rubocop/rubocop/blob/e12b51389500da8e744730f8fa022d739ba0b573/config/obsoletion.yml#L45

Signed-off-by: Tim Smith <[email protected]>
Signed-off-by: Tim Smith <[email protected]>
This is the latest release

Signed-off-by: Tim Smith <[email protected]>
Keep cookstyle at the earlier version so people can migrate off older
chef client releases

Signed-off-by: Tim Smith <[email protected]>
Signed-off-by: Tim Smith <[email protected]>
@tas50 tas50 requested review from a team as code owners December 7, 2024 21:48
tas50 added a commit to test-kitchen/test-kitchen that referenced this pull request Dec 7, 2024
These are the fixes discovered by upgrading to RuboCop 1.69 + enabling
new cops here: chef/cookstyle#984

Signed-off-by: Tim Smith <[email protected]>
config/chefstyle.yml Outdated Show resolved Hide resolved
config/chefstyle.yml Outdated Show resolved Hide resolved
Style/RedundantCurrentDirectoryInPath:
Enabled: true

# Use strings instead of regex with common helper methods

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a dupe of the block starting at line 727?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the checks are the same for cookstyle vs. chefstyle so they're duplicated in both configs

Style/YAMLFileRead:
Enabled: true

# You can't have the same named group in a gemfile twice

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a dupe of the block starting at line 735

Bundler/DuplicatedGroup:
Enabled: true

# Avoid creating and array and interating into it when .map can be used

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch of duplicates in here. Is this supposed to be like that?

@johnmccrae
Copy link

Tim, I approved the other PR but I have some questions inline about this one - some of the cops appear to be duplicates of each other - the block starting around line 720 appears to be duplicated in a block at ~line 3531 or so? There's a couple of small typos that need clarifying too.

damacus pushed a commit to test-kitchen/test-kitchen that referenced this pull request Dec 10, 2024
These are the fixes discovered by upgrading to RuboCop 1.69 + enabling
new cops here: chef/cookstyle#984

Signed-off-by: Tim Smith <[email protected]>
@sean-simmons-progress
Copy link

Related to: #984

tas50 and others added 2 commits December 12, 2024 11:33
Resolves a big pile of bugs

Signed-off-by: Tim Smith <[email protected]>
Copy link

sonarqubecloud bot commented Jan 5, 2025

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 this pull request may close these issues.

3 participants