-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add RuboCop support #2894
Add RuboCop support #2894
Conversation
Hmm. I'm clearly misunderstanding how to get RuboCop into the Gemfile, but I don't get why what I've got isn't working. (Works locally, fails on Travis.) |
Gemfile
Outdated
@@ -2,6 +2,7 @@ source 'https://rubygems.org' | |||
gemspec | |||
|
|||
gem 'jruby-openssl', :platforms => :jruby | |||
gem 'rubocop', '~> 0.57.2', require: false |
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.
We don't require: false, eg. activeadmin/activeadmin@508287f
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 dropped the require: false
and it still dies.
task :test => 'test:units' | ||
|
||
RuboCop::RakeTask.new |
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.
Looks good to me. FWIW we went with https://github.com/activeadmin/activeadmin/pull/5174/files
a38f8dc
to
9710535
Compare
@activemerchant/spreedly-runtime This is ready for an approval/rejection at this point; it's passing CI and clean to merge. |
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 introduces RuboCop to Active Merchant, defaulting to the normal Ruby community guidelines. To grandfather in our existing code, I've pre-generated a `.rubocop_todo.yml` file, which will allow gradual migration. To run RuboCop, you can run `rake rubocop`, but I've also introduced a test:local Rake target that runs both the unit tests and RuboCop checks. I've made this be the default Rake task as well, which means Travis will (if this PR lands) require RuboCop passing for test approval. As a proof-of-concept, I went ahead and fixed WhenThen and YodaConditional style violations, which had sufficiently few violations to work for demo purposes. All PayPal-related code is excluded because it crashes RuboCop. Unit: 3864 tests, 67919 assertions, 0 failures, 0 errors, 0 pendings, 2 omissions, 0 notifications 100% passed
This introduces RuboCop to Active Merchant, defaulting to the normal
Ruby community guidelines. To grandfather in our existing code, I've
pre-generated a
.rubocop_todo.yml
file, which will allowgradual migration.
To run RuboCop, you can run
rake rubocop
, but I've also introduced atest:local Rake target that runs both the unit tests and RuboCop
checks. I've made this be the default Rake task as well, which means
Travis will (if this PR lands) require RuboCop passing for test
approval.
As a proof-of-concept, I went ahead and fixed WhenThen and
YodaConditional style violations, which had sufficiently few violations
to work for demo purposes.
All PayPal-related code is excluded because it crashes RuboCop.
Unit: 3864 tests, 67919 assertions, 0 failures, 0 errors, 0 pendings, 2 omissions, 0 notifications
100% passed