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 to 0.74.0 #1914

Merged
merged 3 commits into from
Aug 16, 2019
Merged

Bump RuboCop to 0.74.0 #1914

merged 3 commits into from
Aug 16, 2019

Conversation

yahonda
Copy link
Collaborator

@yahonda yahonda commented Aug 16, 2019

This pull request bumps RuboCop to 0.74.0 and uses the same rubocop-performance gem CodeClimate provided

* Rename `EnforcedStyle` of `Layout/IndentationConsistency` cop
from `rails` to `indented_internal_methods`

* Disable `Layout/SpaceAroundOperators` cop

Refer rails/rails#36943
@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

@koic I see that rubocop-performance gem available at CodeClimate is 1.3.0, not 1.4.1.

What do you think about setting a version number limit to rubocop-performance gem as CodeClimate supports?

@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

@koic Nevermind. Let's use rubocop-performance 1.3.x.

@koic
Copy link
Collaborator

koic commented Aug 16, 2019

I see that rubocop-performance gem available at CodeClimate is 1.3.0, not 1.4.1.

I guess it depends on codeclimate-rubocop's Gemfile.lock.

The following detection is not supported until RuboCop Performance 1.4.1.
rubocop/rubocop-performance#73

% cd path/to/ocracle-enhanced
% bundle exec rubocop -a
Inspecting 66 files
...........C...................................C...C...C...C......

Offenses:

spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb:183:58: C: [Corrected] Performance/RegexpMatch: Use match? instead of match when MatchData is not used.
      params[:database] = "/#{params[:database]}" unless params[:database].match(/^\//)
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb:650:46: C: [Corrected] Performance/RegexpMatch: Use match? instead of =~ when MatchData is not used.
              field["data_default"] = nil if field["data_default"] =~ /^(null|empty_[bc]lob\(\))$/i
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:68:21: C: [Corrected] Performance/RegexpMatch: Use match? instead of =~ when MatchData is not used.
          return if sql =~ /FROM all_/
                    ^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:321:35: C: [Corrected] Performance/RegexpMatch: Use match? instead of =~ when MatchData is not used.
            host = "[#{host}]" if host =~ /^[^\[].*:/  # IPv6
                                  ^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:323:46: C: [Corrected] Performance/RegexpMatch: Use match? instead of match when MatchData is not used.
            database = "/#{database}" unless database.match(/^\//)
                                             ^^^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb:241:26: C: [Corrected] Performance/RegexpMatch: Use match? instead of =~ when MatchData is not used.
            raise unless e.message =~ /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

66 files inspected, 6 offenses detected, 6 offenses corrected

You will be able to check the version of Code Climate if you leave the above code as it is and specify RuboCop Performance 1.4.1 in the Gemfile of this repo.

Can you confirm it?

@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

Thanks for the answer. Yes, I have confirmed Performance/RegexpMatch: detects these offenses using RuboCop Performance 1.4.1.

I'd like to use the same RuboCop and RuboCop Performance gem version which CodeClimate provides. Actually, I'd like to know if there is any way to run the latest versions of them but this is another topic.

@yahonda yahonda requested a review from koic August 16, 2019 00:41
@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

@koic I'd like to get your review to confirm that we are on the same page.

@koic
Copy link
Collaborator

koic commented Aug 16, 2019

Thanks for the confirm.

Actually, I'd like to know if there is any way to run the latest versions of them but this is another topic.

Yeah, the concern will be feedback to Code Climate's issue.
https://github.com/codeclimate/codeclimate-rubocop/issues

Gemfile Outdated
gem "rubocop", "~> 0.71.0", require: false
gem "rubocop-performance", require: false
gem "rubocop", "~> 0.74.0", require: false
gem "rubocop-performance", "~> 1.3.0", require: false
gem "rubocop-rails", require: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

Thanks for the review. Updated to lock rubocop-rails version to 2.0.x.

Although I do not think rubocop-rails 2.0.1 or 2.0.2 is released because the latest version is already 2.3.0. I'd like to keep Gemfile allow patch versions to be installed.

Copy link
Collaborator

@koic koic left a comment

Choose a reason for hiding this comment

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

I get it. This change looks good to me.

@koic koic merged commit 7038d1b into rsim:master Aug 16, 2019
@yahonda yahonda deleted the rubocop_0740 branch August 16, 2019 05:56
@yahonda
Copy link
Collaborator Author

yahonda commented Aug 16, 2019

Thanks again for the review.

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.

None yet

2 participants