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 0.48 #8652
Upgrade rubocop to 0.48 #8652
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added settings about new cops.
Let's discuss this.
.rubocop.yml
Outdated
@@ -81,6 +81,16 @@ Style/DotPosition: | |||
Style/DoubleNegation: | |||
Enabled: false | |||
|
|||
Style/SymbolArray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SymbolArray
cop is enabled by default.
This cop changes all []
into %i
.
It has big effect on entire project.
So I disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation is great. Can you add it as a comment above the config item so we can easily see why we did it?
.rubocop.yml
Outdated
Style/SymbolArray: | ||
Enabled: false | ||
|
||
Style/IndentHeredoc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IndentHeredoc
is introduced from Ruby 2.3.
However, we have to support Ruby 2.0.0.
So I disabled.
ref: rubocop/rubocop#4028
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation is great. Can you add it as a comment above the config item so we can easily see why we did it?
- '**/Rakefile' | ||
- '**/Fastfile' | ||
- '**/Deliverfile' | ||
- '**/Snapfile' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files are checked by default.
So I ignored.
https://github.com/bbatsov/rubocop/pull/3997/files#diff-af441552566679e9498e0a466229a484R32
.rubocop.yml
Outdated
Style/IndentHeredoc: | ||
Enabled: false | ||
|
||
Style/MixinGrouping: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref: rubocop/rubocop#3936
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this rubocop/rubocop#4172
@@ -89,6 +99,9 @@ Lint/HandleExceptions: | |||
Lint/UnusedBlockArgument: | |||
Enabled: false | |||
|
|||
Lint/AmbiguousBlockAssociation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer AmbiguousBlockAssociation
is enabled 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -58,8 +58,8 @@ def self.run(params) | |||
# Removes .plist files that matched the given expression in the 'ignore' parameter | |||
ignore_expression = params[:ignore] | |||
if ignore_expression | |||
info_plist_files.select! do |info_plist_file| | |||
!info_plist_file.match(ignore_expression) | |||
info_plist_files.reject! do |info_plist_file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are caused by InverseMethod
cop.
https://github.com/bbatsov/rubocop/blob/c06b2e34d1a6108e03cd5c03761db28167005829/manual/cops_style.md#styleinversemethods
I think it should be enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that looks fine 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
We need more approval ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks @giginet for this 👍 Please add the comments to the .rubocop.yml
, then it's ready to be merged. Also, can you run the test suite on Ruby 2.0 to make sure everything works as expected?
@@ -58,8 +58,8 @@ def self.run(params) | |||
# Removes .plist files that matched the given expression in the 'ignore' parameter | |||
ignore_expression = params[:ignore] | |||
if ignore_expression | |||
info_plist_files.select! do |info_plist_file| | |||
!info_plist_file.match(ignore_expression) | |||
info_plist_files.reject! do |info_plist_file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that looks fine 👍
@@ -43,7 +43,7 @@ def self.run(params) | |||
file_ruby = file.gsub('\ ', ' ') | |||
File.exist?(file_ruby) and | |||
(!select_regex or file_ruby =~ select_regex) and | |||
(!exclude_regex or !(file_ruby =~ exclude_regex)) | |||
(!exclude_regex or file_ruby !~ exclude_regex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this syntax also work with Ruby 2.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!~
operator is available since 1.9. So we can use this on Apple Ruby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, sounds good 👍
I ran |
Thanks for reviewing! |
Hey @giginet 👋 Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉 Please let us know if this change requires an immediate release by adding a comment here 👍 |
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validDescription
Updated rubocop to latest version and
.rubocop.yml
.Motivation and Context
rubocop 0.48 has been released.
Because of this change, CI is failing.
#8649
So I updated rubocop and
.rubocop.yml
.