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

Rubocop autocorrect all Ruby files, fail CI if warnings found #172

Merged
merged 19 commits into from
Feb 17, 2024

Conversation

PatrickF1
Copy link
Owner

@PatrickF1 PatrickF1 commented Feb 15, 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.

@PatrickF1 PatrickF1 changed the title [Rubocop] Run rubocop autocorrect on everything Rubocop autocorrect all ruby files, fail CI if warnings found Feb 17, 2024
@PatrickF1 PatrickF1 changed the title Rubocop autocorrect all ruby files, fail CI if warnings found Rubocop autocorrect all Ruby files, fail CI if warnings found Feb 17, 2024
@PatrickF1 PatrickF1 enabled auto-merge (squash) February 17, 2024 22:16
@PatrickF1 PatrickF1 merged commit 6d08b7b into main Feb 17, 2024
1 check passed
@PatrickF1 PatrickF1 deleted the rubocop-auto-correct branch February 17, 2024 22:18
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.

1 participant