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

Bring ABC size down to 16 #7453

Merged
merged 10 commits into from
Oct 23, 2019
Merged

Bring ABC size down to 16 #7453

merged 10 commits into from
Oct 23, 2019

Conversation

Drenmi
Copy link
Collaborator

@Drenmi Drenmi commented Oct 23, 2019

I wanted to cement the excellent work done by @buehmann in #7450 by bringing the bar down to 16. That way we can't have new offenses creeping in without notice.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@@ -429,6 +429,7 @@ def compile_ellipsis
[0..Float::INFINITY, 'true']
end

# rubocop:disable Metrics/AbcSize
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Couldn't find any way to refactor this method that didn't make it worse. Pretty sure this is as good as it gets with the current design, but open to suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Challenge accepted 😉 #7457

@bbatsov bbatsov merged commit ffc0678 into rubocop:master Oct 23, 2019
@bbatsov
Copy link
Collaborator

bbatsov commented Oct 23, 2019

🙇

@Drenmi Drenmi deleted the maintenance/abc-size branch October 23, 2019 11:30
@condition += 1
end

def else_branch?(node)
%i[case if].include?(node.type) &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jonas054 I suspect we could have a subtle bug here. We check for #else_branch? on CONDITION_NODES, which comes from CyclomaticComplexity::COUNTED_NODES, but that list does not include case:

COUNTED_NODES = %i[if while until for
                   rescue when and or].freeze

@jaredbeck
Copy link
Contributor

jaredbeck commented Aug 11, 2020

Reduce ABC size of AbcSizeCalculator (5eb411b)

so meta 😆

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

4 participants