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

Bump rubocop from 1.56.4 to 1.57.1 #582

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GEM
method_source (1.0.0)
minitest (5.20.0)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pry (0.14.1)
Expand All @@ -29,14 +29,14 @@ GEM
racc (1.7.1)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.1)
regexp_parser (2.8.2)
rexml (3.2.6)
rubocop (1.56.4)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
Expand Down
7 changes: 7 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% rubocop_version = Gem.loaded_specs.fetch("rubocop").version %>
Copy link
Member

Choose a reason for hiding this comment

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

Is this the version on the bundle or in the system?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the version of whatever the process is running, depending on if bundle exec (or equivalent binstub) is used or not.

Added logging and binstub

% git diff -U1
diff --git a/rubocop.yml b/rubocop.yml
index aab03ce..99bae8c 100644
--- a/rubocop.yml
+++ b/rubocop.yml
@@ -1,2 +1,4 @@
 <% rubocop_version = Gem.loaded_specs.fetch("rubocop").version %>
+<% puts "RUBOCOP VERSION:          #{rubocop_version}" %>
+<% puts "RUBOCOP-MINITEST VERSION: #{Gem.loaded_specs["rubocop-minitest"]&.version}" %>
% bundle binstubs rubocop

bundle info

% bundle info rubocop | grep '*'
  * rubocop (1.57.1)
% bundle info rubocop-minitest
Could not find gem 'rubocop-minitest'.

gem info rubocop

% bundle exec gem info rubocop | grep '^rubocop'
rubocop (1.57.1)
% gem info rubocop | grep '^rubocop' 
rubocop (1.57.2, 1.57.1, 1.56.4, 1.56.3, 1.56.2, 1.56.1, 1.55.1, 1.54.2, 1.54.1, 1.52.1, 1.52.0, 1.50.2, 1.50.0, 1.49.0, 1.30.1)

gem info rubocop-minitest

% bundle exec gem info rubocop-minitest | grep '^rubocop'
% gem info rubocop-minitest | grep '^rubocop' 
rubocop-minitest (0.32.2, 0.31.0)

Running rubocop

% bundle exec rubocop | grep VERSION
RUBOCOP VERSION:          1.57.1
RUBOCOP-MINITEST VERSION: 
% bin/rubocop | grep VERSION
RUBOCOP VERSION:          1.57.1
RUBOCOP-MINITEST VERSION: 
% rubocop | grep VERSION
RUBOCOP VERSION:          1.57.2
RUBOCOP-MINITEST VERSION: 


inherit_mode:
merge:
- Exclude
Expand Down Expand Up @@ -794,6 +796,11 @@ Style/SelectByRegexp:
Style/SingleArgumentDig:
Enabled: false

<% if rubocop_version >= Gem::Version.new('1.57') %>
Style/SingleLineDoEndBlock:
Enabled: true
<% end %>
Comment on lines +799 to +802
Copy link
Contributor

Choose a reason for hiding this comment

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

@rafaelfranca Trying something new here.

Typically, when a new cop is released, we enable or disable it, but that requires bumping the minimum RuboCop version (as older versions will complain they don't know about that cop).

As per our discussion about plugins, we'll have to take this approach to selectively enable plugin cops, as we won't be able to rely on Bundler/Rubygems to enforce any version requirement (without adding a dependency from rubocop-shopify to the various plugins, which we don't want to do).

Therefore, I'm trying out this approach here first.

Note that rubocop-shopify.gemspec has not changed, and CI is passing across all versions tested.


Style/SlicingWithRange:
Enabled: false

Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/full_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,9 @@ Lint/RedundantRegexpQuantifiers:
Lint/RedundantRequireStatement:
Description: Checks for unnecessary `require` statement.
Enabled: false
SafeAutoCorrect: false
VersionAdded: '0.76'
VersionChanged: '1.57'
Lint/RedundantSafeNavigation:
Description: Checks for redundant safe navigation calls.
Enabled: false
Expand Down Expand Up @@ -2488,7 +2490,9 @@ Style/ClassEqualityComparison:
for equality.
StyleGuide: "#instance-of-vs-class-comparison"
Enabled: false
SafeAutoCorrect: false
VersionAdded: '0.93'
VersionChanged: '1.57'
AllowedMethods:
- "=="
- equal?
Expand Down Expand Up @@ -3722,7 +3726,9 @@ Style/RedundantFilterChain:
methods chained to `select`/`filter`/`find_all` and change them to use predicate
method instead.
Enabled: true
SafeAutoCorrect: false
VersionAdded: '1.52'
VersionChanged: '1.57'
Style/RedundantFreeze:
Description: Checks usages of Object#freeze on immutable objects.
Enabled: true
Expand Down Expand Up @@ -3935,6 +3941,10 @@ Style/SingleLineBlockParams:
- inject:
- acc
- elem
Style/SingleLineDoEndBlock:
Description: Checks for single-line `do`...`end` blocks.
Enabled: true
VersionAdded: '1.57'
Style/SingleLineMethods:
Description: Avoid single-line methods.
StyleGuide: "#no-single-line-methods"
Expand Down