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

Add RuboCop support #2894

Merged
merged 1 commit into from
Jun 26, 2018
Merged

Add RuboCop support #2894

merged 1 commit into from
Jun 26, 2018

Conversation

bpollack
Copy link
Contributor

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

@bpollack bpollack requested review from bdewater and a team June 19, 2018 16:02
@bpollack
Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpollack
Copy link
Contributor Author

@activemerchant/spreedly-runtime This is ready for an approval/rejection at this point; it's passing CI and clean to merge.

Copy link
Contributor

@curiousepic curiousepic left a 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
@bpollack bpollack merged commit 974aa50 into master Jun 26, 2018
@bpollack bpollack deleted the rubocop branch June 26, 2018 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants