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

Fix severity conversion; calculate overall severity based on RuboCop fail level #84

Merged
merged 6 commits into from
Jun 7, 2023

Conversation

reidab
Copy link
Contributor

@reidab reidab commented Jun 1, 2023

RuboCop's severity levels are represented by RuboCop::Cop::Severity objects, not symbols. Internally, this objects holds a symbol in its name attribute an implements comparison methods.

Sadly, these comparisons aren't reversable: severity === :info => true, but :info === severity => false.

The ruby case statement performs tripple-equals comparisons with the argument to the when clause as the first operand, so the existing case statement always returned UNKNOWN_SEVERITY.

In addition to fixing the above issue, this PR adds mappings for the non-standard RuboCop convention and refactor severity levels to INFO and calculates a top-level severity value in the rdjson output based on RuboCop's configured fail level.

Fixes #75

reidab added 3 commits May 30, 2023 11:43
RuboCop's severity levels are represented by RuboCop::Cop::Severity obejcts, not symbols.
Internally, this objects holds a symbol in its `name` attribute an implements comparison methods.

Sadly, these comparisons aren't reversable: `severity === :info => true`, but `:info === severity => false`.

The ruby case statement performs tripple-equals comparisons with the argument to the `when` clause
as the first operand, so the existing case statement always returned `UNKNOWN_SEVERITY`.
@mgrachev
Copy link
Member

mgrachev commented Jun 2, 2023

@reidab Thank for your contribution 👍

Before merging, please fix CI builds in your PR 🙏

@reidab
Copy link
Contributor Author

reidab commented Jun 6, 2023

Okay, that should be cleaned up now.

@mgrachev mgrachev merged commit c3efa96 into reviewdog:master Jun 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

🚀 [bumpr] Bumped! New version:v2.3.3 Changes:v2.3.2...v2.3.3

@review-dog
Copy link
Member

Hi, @reidab! We merged your PR to reviewdog! 🐶
Thank you for your contribution! ✨

We just invited you to join the @reviewdog organization on GitHub.
Accept the invite by visiting https://github.com/orgs/reviewdog/invitation.
By joining the team, you'll be a part of reviewdog community and can help the maintenance of reviewdog.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rubocop info severity causes build failure
3 participants