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
Use GitHub actions to run RuboCop linter #5820
Conversation
522d406
to
22d059f
Compare
rubocop_test.rb
Outdated
# BAD: fail only signal exception | ||
begin | ||
fail | ||
rescue StandardError |
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.
Lint/SuppressedException: Do not suppress exceptions.
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.
Hadn't intended this to be checked - not picked up locally when running bundle exec rubocop -D rubocop_test.rb
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 wasn't raised in the GitHub action runner, I think because Hound is using Rubocop 0.80.1, instead of 0.81.0 - there was this change rubocop/rubocop#7805
Doesn't explain the other consistencies tho.
rubocop_test.rb
Outdated
end | ||
# BAD: fail only signal exception | ||
begin | ||
fail |
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.
Style/SignalException: Always use raise to signal exceptions.
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.
Correct
rubocop_test.rb
Outdated
# GOOD: raise only signal exception | ||
begin | ||
raise | ||
rescue StandardError |
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.
Lint/SuppressedException: Do not suppress exceptions.
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.
Hadn't intended this to be checked - not picked up locally when running bundle exec rubocop -D rubocop_test.rb
rubocop_test.rb
Outdated
# GOOD: lines over 80 characters | ||
_short_line = 'This line is under 80 characters.' | ||
# BAD: lines over 80 characters | ||
_long_line = 'This line is going to really long and be over the 80 characters.' |
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.
Layout/LineLength: Line is too long. [81/80]
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.
Correct
rubocop_test.rb
Outdated
# BAD: old style hash syntax | ||
_bad1_hash = { :bar => 'bar' } | ||
# BAD: mixed keys syntax | ||
_bad2_hash = { foo: 'foo', :bar => 'bar' } |
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.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
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.
Correct
rubocop_test.rb
Outdated
# GOOD: new style hash syntax, with no mixed keys | ||
_good_hash = { foo: 'foo' } | ||
# BAD: old style hash syntax | ||
_bad1_hash = { :bar => 'bar' } |
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.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
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.
Correct
rubocop_test.rb
Outdated
# | ||
class RubocopTest | ||
# GOOD: trailing dots | ||
'Hello world'. |
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.
Layout/DotPosition: Place the . on the next line, together with the method name.
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 is using the wrong enforced style: https://github.com/mysociety/alaveteli/blob/develop/.ruby-style.yml#L100-L102
rubocop_test.rb
Outdated
@@ -0,0 +1,35 @@ | |||
# This class is a test of Rubocop linting |
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.
Style/FrozenStringLiteralComment: Missing frozen string literal comment.
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 shouldn't be running: https://github.com/mysociety/alaveteli/blob/develop/.ruby-style.yml#L1093-L1094
So instead of fixing HoundCI I'm purposing switching to a GitHub Action workflow. It will allow us more flexibilities with regard to gem version and RuboCop extensions. Even better it doesn't pollute the PR with comments. @garethrees what are your thoughts? If you approve I'll drop the hound config and remove the RuboCop test file from this PR. |
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 seems to be ongoing issues with HoundCI, and the lately it seems to be ignoring out RuboCop config completely.
22d059f
to
e5f1c08
Compare
Discussed on standup, we're happy for this to be merged as is. |
There seems to be ongoing issues with HoundCI, and the lately it seems
to be ignoring out RuboCop config completely.