Skip to content

Instantly share code, notes, and snippets.

@Serg0
Forked from djburdick/rubocop_circleci.rb
Created June 23, 2022 23:04
Show Gist options
  • Save Serg0/f43099f55ea4bd31dc9e31ced0963e64 to your computer and use it in GitHub Desktop.
Save Serg0/f43099f55ea4bd31dc9e31ced0963e64 to your computer and use it in GitHub Desktop.
Run rubocop with circleci
# In spec_helper.rb
RSpec.configure do |config|
....
rubocop_output = `rubocop`
print rubocop_output
fail "RuboCop Errors" unless rubocop_output.match(/files inspected, no offenses detected/)
end
# In .rubocop.yml
# Make sure to exclude unused dirs or it'll run 10,000+ files in circleci
AllCops:
Exclude:
- "db/**/*"
- "tmp/**/*"
- "vendor/**/*"
- "bin/**/*"
- "log/**/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment