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

Update rubocop requirement from ~> 0.88.0 to ~> 0.90.0 in /common #2496

Merged
merged 16 commits into from Sep 15, 2020

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 2, 2020

Human extension of Dependabot's start

  • upgrade rubocop to 0.90.0 (thanks Dependabot)
  • configure new cops added since 0.88.0
    • Lint/MissingSuper, Style/KeywordParametersOrder, Style/OptionalBooleanParameter, Style/StringConcatenation disabled
    • all others enabled 🎉
  • most changes relate to Metrics/PerceivedComplexity, which changed calculation methods
    • raise the default complexity to 10, from 7 previously, or 8 as the default in 0.90.0
    • remove annotations no longer necessary with raised limit
    • add annotations required by new method
  • 👁️ the interesting changes are Style/SoleNestedConditional corrections: look for if/unless in diffs
  • most other changes are comments

Updates the requirements on rubocop to permit the latest version.

Release notes

Sourced from rubocop's releases.

RuboCop 0.90

New features

Bug fixes

  • #8508: Fix a false positive for Style/CaseLikeIf when conditional contains comparison with a class. Mark Style/CaseLikeIf as not safe. (@fatkodima)
  • #8618: Fix an infinite loop error for Layout/EmptyLineBetweenDefs. (@fatkodima)
  • #8534: Fix Lint/BinaryOperatorWithIdenticalOperands for binary operators used as unary operators. (@marcandre)
  • #8537: Allow a trailing comment as a description comment for Bundler/GemComment. (@pocke)
  • #8507: Fix Style/RescueModifier to handle parentheses around rescue modifiers. (@dsavochkin)
  • #8527: Prevent an incorrect auto-correction for Style/CaseEquality cop when comparing with === against a regular expression receiver. ([@koic][])
  • #8524: Fix Layout/EmptyLinesAroundClassBody and Layout/EmptyLinesAroundModuleBody to correctly handle an access modifier as a first child. (@dsavochkin)
  • #8518: Fix Lint/ConstantResolution cop reporting offense for module and class definitions. ([@tejasbubane][])
  • #8158: Fix Style/MultilineWhenThen cop to correctly handle cases with multiline body. (@dsavochkin)
  • #7705: Fix Style/OneLineConditional cop to handle if/then/elsif/then/else/end cases. Add AlwaysCorrectToMultiline config option to this cop to always convert offenses to the multi-line form (false by default). ([@Lykos][], @dsavochkin)
  • #8590: Fix an error when auto-correcting encoding mismatch file. ([@koic][])
  • #8321: Enable auto-correction for Layout/{Def}EndAlignment, Lint/EmptyEnsure, Style/ClassAndModuleChildren. (@marcandre)
  • #8583: Fix Style/RedundantRegexpEscape false positive for line continuations. ([@owst][])
  • #8593: Fix Style/RedundantRegexpCharacterClass false positive for interpolated multi-line expressions. ([@owst][])
  • #8624: Fix an error with the Style/CaseLikeIf cop where it does not properly handle overridden equality methods with no arguments. ([@Skipants][])

Changes

  • #8413: Pending cops warning now contains snippet that can be directly copied into .rubocop.yml as well as a notice about NewCops: enable config option. ([@colszowka][])
  • #8362: Add numbers of correctable offenses to summary. ([@nguyenquangminh0711][])
  • #8513: Clarify the ruby warning mentioned in the Lint/ShadowingOuterLocalVariable documentation. ([@chocolateboy][])
  • #8517: Make Style/HashTransformKeys and Style/HashTransformValues aware of to_h with block. ([@eugeneius][])
  • #8529: Mark Lint/FrozenStringLiteralComment as Safe, but with unsafe auto-correction. (@marcandre)
  • #8602: Fix usage of to_enum(:scan, regexp) to work on TruffleRuby. ([@jaimerave][])
Changelog

Sourced from rubocop's changelog.

0.90.0 (2020-09-01)

New features

Bug fixes

  • #8508: Fix a false positive for Style/CaseLikeIf when conditional contains comparison with a class. Mark Style/CaseLikeIf as not safe. ([@fatkodima][])
  • #8618: Fix an infinite loop error for Layout/EmptyLineBetweenDefs. ([@fatkodima][])
  • #8534: Fix Lint/BinaryOperatorWithIdenticalOperands for binary operators used as unary operators. ([@marcandre][])
  • #8537: Allow a trailing comment as a description comment for Bundler/GemComment. ([@pocke][])
  • #8507: Fix Style/RescueModifier to handle parentheses around rescue modifiers. ([@dsavochkin][])
  • #8527: Prevent an incorrect auto-correction for Style/CaseEquality cop when comparing with === against a regular expression receiver. ([@koic][])
  • #8524: Fix Layout/EmptyLinesAroundClassBody and Layout/EmptyLinesAroundModuleBody to correctly handle an access modifier as a first child. ([@dsavochkin][])
  • #8518: Fix Lint/ConstantResolution cop reporting offense for module and class definitions. ([@tejasbubane][])
  • #8158: Fix Style/MultilineWhenThen cop to correctly handle cases with multiline body. ([@dsavochkin][])
  • #7705: Fix Style/OneLineConditional cop to handle if/then/elsif/then/else/end cases. Add AlwaysCorrectToMultiline config option to this cop to always convert offenses to the multi-line form (false by default). ([@Lykos][], [@dsavochkin][])
  • #8590: Fix an error when auto-correcting encoding mismatch file. ([@koic][])
  • #8321: Enable auto-correction for Layout/{Def}EndAlignment, Lint/EmptyEnsure, Style/ClassAndModuleChildren. ([@marcandre][])
  • #8583: Fix Style/RedundantRegexpEscape false positive for line continuations. ([@owst][])
  • #8593: Fix Style/RedundantRegexpCharacterClass false positive for interpolated multi-line expressions. ([@owst][])
  • #8624: Fix an error with the Style/CaseLikeIf cop where it does not properly handle overridden equality methods with no arguments. ([@Skipants][])

Changes

  • #8413: Pending cops warning now contains snippet that can be directly copied into .rubocop.yml as well as a notice about NewCops: enable config option. ([@colszowka][])
  • #8362: Add numbers of correctable offenses to summary. ([@nguyenquangminh0711][])
  • #8513: Clarify the ruby warning mentioned in the Lint/ShadowingOuterLocalVariable documentation. ([@chocolateboy][])
  • #8517: Make Style/HashTransformKeys and Style/HashTransformValues aware of to_h with block. ([@eugeneius][])
  • #8529: Mark Lint/FrozenStringLiteralComment as Safe, but with unsafe auto-correction. ([@marcandre][])
  • #8602: Fix usage of to_enum(:scan, regexp) to work on TruffleRuby. ([@jaimerave][])

0.89.1 (2020-08-10)

Bug fixes

Commits
  • 95305ff Cut 0.90
  • eb04490 Merge pull request #8595 from marcandre/struct_autocorrect
  • 71c4818 Merge branch 'master' into struct_autocorrect
  • 6d781b0 Revert "Mark Cops and Formatters as private"
  • f69a7a8 Merge pull request #8624 from Skipants/master
  • f877e02 Fix Style/CaseLikeIf not properly handling overriden equality methods
  • 6cab599 Add workaround to avoid crash in Truffleruby (#8602)
  • 2b7607c Fix an infinite loop error for Layout/EmptyLineBetweenDefs
  • 31a921d Use Cop::Base API for Layout department [T-Z]
  • 6c05f69 Use Cop::Base API for Layout department [N-S]
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](rubocop/rubocop@v0.88.0...v0.90.0)

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies ruby Dependabot pull requests that update Ruby code labels Sep 2, 2020
@thepwagner
Copy link
Contributor

This becomes important because of rubocop/rubocop-ast#113

rubocop-ast-0.4.0 breaks our CI. I think we'd rather roll rubocop forward than rubocop-ast back.

An error occurred while Layout/LineLength cop was inspecting /home/dependabot/dependabot-core/hex/spec/dependabot/hex/file_fetcher_spec.rb:217:6.
can't modify frozen Array
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:174:in `pop'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:174:in `process_args'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:120:in `block in contained_by_breakable_collection_on_same_line?'
/home/dependabot/.bundle/gems/rubocop-ast-0.4.0/lib/rubocop/ast/node.rb:637:in `visit_ancestors'
/home/dependabot/.bundle/gems/rubocop-ast-0.4.0/lib/rubocop/ast/node.rb:191:in `each_ancestor'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:113:in `each'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:113:in `find'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:113:in `contained_by_breakable_collection_on_same_line?'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:89:in `safe_to_ignore?'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:59:in `extract_breakable_node_from_elements'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/mixin/check_line_breakable.rb:48:in `extract_breakable_node'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/layout/line_length.rb:102:in `check_for_breakable_node'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/layout/line_length.rb:75:in `on_potential_breakable_node'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:91:in `block (2 levels) in trigger_responding_cops'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:113:in `with_cop_error_handling'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:90:in `block in trigger_responding_cops'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:89:in `each'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:89:in `trigger_responding_cops'
/home/dependabot/.bundle/gems/rubocop-0.88.0/lib/rubocop/cop/commissioner.rb:61:in `block (2 levels) in <class:Commissioner>'

@thepwagner thepwagner self-assigned this Sep 14, 2020
@thepwagner
Copy link
Contributor

thepwagner commented Sep 14, 2020

@feelepxyz @jurre AFAICT the biggest blocker here is Metrics/PerceivedComplexity, which changed the way it was calculated in 0.89.0: rubocop/rubocop#8204

Do we have any sense what our new target should be? The new default, 8, is pretty sensitive against the current codebase:

Offenses:

lib/dependabot/dependency.rb:125:5: R: Metrics/PerceivedComplexity: Perceived complexity for check_requirement_fields is too high. [9/8]
    def check_requirement_fields ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/git_commit_checker.rb:89:5: R: Metrics/PerceivedComplexity: Perceived complexity for local_tag_for_latest_version is too high. [11/8]
    def local_tag_for_latest_version ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/git_metadata_fetcher.rb:149:5: R: Metrics/PerceivedComplexity: Perceived complexity for uri_with_auth is too high. [10/8]
    def uri_with_auth(uri) ...
    ^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/metadata_finders/base/changelog_finder.rb:146:9: R: Metrics/PerceivedComplexity: Perceived complexity for select_best_changelog is too high. [12/8]
        def select_best_changelog(files) ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/metadata_finders/base/changelog_pruner.rb:114:9: R: Metrics/PerceivedComplexity: Perceived complexity for versions_in_changelog_headers is too high. [9/8]
        def versions_in_changelog_headers ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/metadata_finders/base/commits_finder.rb:51:9: R: Metrics/PerceivedComplexity: Perceived complexity for new_tag is too high. [9/8]
        def new_tag ...
        ^^^^^^^^^^^
lib/dependabot/metadata_finders/base/release_finder.rb:109:9: R: Metrics/PerceivedComplexity: Perceived complexity for filter_releases_using_previous_version is too high. [10/8]
        def filter_releases_using_previous_version(releases, conservative:) ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/metadata_finders/base/release_finder.rb:129:9: R: Metrics/PerceivedComplexity: Perceived complexity for filter_releases_using_updated_version is too high. [10/8]
        def filter_releases_using_updated_version(releases, conservative:) ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/metadata_finders/base/release_finder.rb:205:9: R: Metrics/PerceivedComplexity: Perceived complexity for fetch_github_releases is too high. [9/8]
        def fetch_github_releases ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/github.rb:54:7: R: Metrics/PerceivedComplexity: Perceived complexity for branch_exists? is too high. [11/8]
      def branch_exists?(name) ...
      ^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/github.rb:291:7: R: Metrics/PerceivedComplexity: Perceived complexity for comment_with_invalid_reviewer is too high. [9/8]
      def comment_with_invalid_reviewer(pull_request, message) ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/labeler.rb:116:7: R: Metrics/PerceivedComplexity: Perceived complexity for version is too high. [11/8]
      def version(dep) ...
      ^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/labeler.rb:131:7: R: Metrics/PerceivedComplexity: Perceived complexity for previous_version is too high. [11/8]
      def previous_version(dep) ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/message_builder.rb:407:7: R: Metrics/PerceivedComplexity: Perceived complexity for commits_cascade is too high. [9/8]
      def commits_cascade(dep) ...
      ^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/pr_name_prefixer.rb:147:7: R: Metrics/PerceivedComplexity: Perceived complexity for capitalise_first_word_from_previous_commits is too high. [10/8]
      def capitalise_first_word_from_previous_commits ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/pr_name_prefixer.rb:175:7: R: Metrics/PerceivedComplexity: Perceived complexity for using_angular_commit_messages? is too high. [13/8]
      def using_angular_commit_messages? ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/pr_name_prefixer.rb:290:7: R: Metrics/PerceivedComplexity: Perceived complexity for recent_github_commit_messages is too high. [9/8]
      def recent_github_commit_messages ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_creator/pr_name_prefixer.rb:346:7: R: Metrics/PerceivedComplexity: Perceived complexity for last_github_dependabot_commit_message is too high. [10/8]
      def last_github_dependabot_commit_message ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_updater/github.rb:93:7: R: Metrics/PerceivedComplexity: Perceived complexity for create_commit is too high. [10/8]
      def create_commit ...
      ^^^^^^^^^^^^^^^^^
lib/dependabot/pull_request_updater/github.rb:188:7: R: Metrics/PerceivedComplexity: Perceived complexity for commit_being_updated is too high. [10/8]
      def commit_being_updated ...
      ^^^^^^^^^^^^^^^^^^^^^^^^
lib/dependabot/shared_helpers.rb:181:5: R: Metrics/PerceivedComplexity: Perceived complexity for configure_git_credentials is too high. [12/8]
    def self.configure_git_credentials(credentials)

I'm tempted to:

  1. raise the max to 10
  2. add/remove # rubocop:disable Metrics/PerceivedComplexity as needed.

Since the scope of (2) varies wildly based on the value picked in (1): does 10 sound reasonable?

@feelepxyz
Copy link
Contributor

Since the scope of (2) varies wildly based on the value picked in (1): does 10 sound reasonable?

Seems ok, this has happened a few times already so cool with relaxing this a bit.

Copy link
Contributor

@feelepxyz feelepxyz left a comment

Choose a reason for hiding this comment

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

Nice one! 💯

Co-authored-by: Philip Harrison <philip@mailharrison.com>
@thepwagner thepwagner removed the request for review from jurre September 15, 2020 17:22
@thepwagner thepwagner merged commit 4b46832 into main Sep 15, 2020
@thepwagner thepwagner deleted the dependabot/bundler/common/rubocop-tw-0.90.0 branch September 15, 2020 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies ruby Dependabot pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants