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
Question: fail only if autocorrectable offenses #12702
Labels
Comments
PatrickF1
added a commit
to PatrickF1/GraceTunes
that referenced
this issue
Feb 17, 2024
I want to require everyone to properly lint their files before merging to master to reduce bugs. Ideally, we would also automatically run `rubocop --autocorrect` on file save (easily achievable through an editor integration) so all our code has consistent style and conventions. So, this PR - updates to and requires the current latest RuboCop - removed some annoying code metric cops - turned on a few disabled cops I found useful - rubocop autocorrected all our Ruby files to fix our current warnings and prevent autocorrect from producing out-of-scope diffs in subsequent PRs - updated CI to fail builds if there are warning-level offenses detected Ideally, CI would also fail if there are autocorrectable offenses, even if not warning level, but I couldn't figure out how. I asked in rubocop/rubocop#12702 and will follow up once I get the answer. I will update our dev docs to make it clear we should be using RuboCop.
If the rubocop --format json | \
jq '.files[].offenses[] | select(.correctable) | length > 0' | \
grep --quiet true && \
echo "Found correctable offenses!" Otherwise you could write a Ruby program to do the parsing. Anyway, I think outputting JSON from RuboCop and then using some other tool to detect |
Thank you Jonas, I'll just do that. So it sounds like this isn't a feature? If so, then I'd like to make it a feature request then. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for making Rubocop so awesome!
I want to make sure all the devs on my repo are running Rubocop autocorrect (automatically through their editors) before committing. What is a rubocop command I can run in CI that will fail if there are any autocorrectable offenses but will not fail if there are only info/convention offenses that are not autocorrectable?
Thanks!
The text was updated successfully, but these errors were encountered: