-
Notifications
You must be signed in to change notification settings - Fork 98
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 theforeman-rubocop gem #750
Conversation
.rubocop.yml
Outdated
- rules/base.yml | ||
- rules/ruby_target.yml | ||
- rules/style.yml | ||
- rules/metrics.yml | ||
- rules/performance.yml | ||
- rules/rails.yml | ||
- rules/minitest.yml | ||
- rules/style_lenient.yml |
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 enables almost all the same rules and doesn't cause additional violations. It's also easier to use a single file than to pick individual rulesets.
- rules/base.yml | |
- rules/ruby_target.yml | |
- rules/style.yml | |
- rules/metrics.yml | |
- rules/performance.yml | |
- rules/rails.yml | |
- rules/minitest.yml | |
- rules/style_lenient.yml | |
- lenient.yml |
.rubocop.yml
Outdated
- 'node_modules/**/*' | ||
- 'locale/*' | ||
- 'vendor/**/*' | ||
TargetRubyVersion: 2.7 |
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 still needed because it uses Ruby 2.7+ syntax.
.rubocop_todo.yml
Outdated
# Offense count: 2 | ||
# Cop supports --auto-correct. | ||
Lint/RedundantCopDisableDirective: | ||
Exclude: | ||
- 'lib/foreman_tasks/tasks/export_tasks.rake' |
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.
Please remove the rubocop control statements instead
.rubocop.yml
Outdated
Exclude: | ||
- 'node_modules/**/*' | ||
- 'locale/*' | ||
- 'vendor/**/*' |
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.
If you keep Exclude
, you must include this. It's causing the CI failures. And node_modules
is probably just for performance, because it's scanning a lot of files that aren't needed.
That said, rules/base.yml
already has a good definition in rules/base so I'd leave the whole Exclude
out. If locale
is a problem, I wonder why it is.
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.
I decided to keep it as it was previously because of this failure:
app/models/foreman_tasks/concerns/action_triggering.rb:30:17: E: Lint/Syntax: unexpected token tDOT3
(Using Ruby 2.5 parser; configure using TargetRubyVersion parameter, under AllCops)
def save!(...)
and added few cops offense count in the rubocop todo file.
Choose to inherit some cops only, because i wanted to inherit rules from style_lenient.yml as well, i followed this: https://github.com/theforeman/theforeman-rubocop?tab=readme-ov-file#choose-just-some-cops Also drop some cops from the .rubocop.yml config, because that was present in inherit-gem and clean gemfile by adding theforeman-rubocop gem. This is part of Rubocop standerdization, link for the reference: https://community.theforeman.org/t/standardizing-rubocop-with-theforeman-rubocop/37239
Thank you @archanaserver ! |
Choose to inherit some cops only, because i wanted to inherit rules from style_lenient.yml as well, i followed this:
https://github.com/theforeman/theforeman-rubocop?tab=readme-ov-file#choose-just-some-cops
Also drop some cops from the .rubocop.yml config, because that was present in inherit-gem and clean gemfile by adding theforeman-rubocop gem.
This is part of Rubocop standerdization, link for the reference: https://community.theforeman.org/t/standardizing-rubocop-with-theforeman-rubocop/37239