-
Notifications
You must be signed in to change notification settings - Fork 34
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 rake task #152
Add rubocop rake task #152
Conversation
Working towards Issue #149 |
.rubocop.yml
Outdated
# Configuration hierarchy: | ||
# | ||
# 1. Rubocop defaults | ||
# 2. Carbon Five defaults (this file) | ||
# 3. Project overrides | ||
# | ||
# See http://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url for details. | ||
# |
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 think we should remove this since it only relevant to the inherit_from:
directive, which we are not using here.
lib/tasks/rubocop.rake
Outdated
require "rubocop/rake_task" | ||
|
||
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.
I'd prefer we inline this in the Rakefile
because putting this in lib
implies that it is meant to be packaged and distributed as part of the raygun gem.
raygun.gemspec
Outdated
@@ -23,4 +23,5 @@ Gem::Specification.new do |gem| | |||
|
|||
gem.add_development_dependency "bundler", "~> 2.0" | |||
gem.add_development_dependency "rake", "~> 13.0" | |||
gem.add_development_dependency "rubocop", "~> 0.79" |
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.
Since we are not committing a Gemfile.lock
I think we should pin rubocop here. New versions of rubocop often contain breaking changes, unfortunately.
gem.add_development_dependency "rubocop", "~> 0.79" | |
gem.add_development_dependency "rubocop", "0.79.0" |
@@ -1,10 +1,10 @@ | |||
#!/usr/bin/env ruby | |||
|
|||
File.expand_path('../../lib', __FILE__).tap do |lib| | |||
File.expand_path("../lib", __dir__).tap do |lib| |
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.
👍
|
||
AllCops: | ||
DisplayCopNames: true | ||
DisplayStyleGuide: true |
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.
Non-blocking: It would be good to explicitly specify the version of Ruby compatibility that we are aiming for here:
DisplayStyleGuide: true | |
DisplayStyleGuide: true | |
TargetRubyVersion: 2.4 |
We can do this in a separate PR when we fix the other non-autocorrectable RuboCop issues.
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.
Interestingly, rubocop complains that the gemspec required version doesn't match that of the rubocop.yml so fixing this will fix a rubocop warning.
7c0aeca
to
c6fe3aa
Compare
410c332
to
9b6788b
Compare
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 think I hit all the PR comments.
Look for a follow up PR which is "manually fix rubocop warnings/issues"
Style/PreferredHashMethods: | ||
Enabled: false | ||
|
||
Style/SpecialGlobalVars: |
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.
Note: Disabled this cop. It is not in the c5-conventions
version yet (expect a PR soon).
It prefers (and auto corrects) the use of globals like $?
with $CHILD_STATUS
etc.
The problem is if you autocorrect, and try to run the code, unless you've already require 'english'
in your code, this will cause the code to fail.
Before we enforce this, we should think about how to set it and also if we want to require 'english'
just so we can get rubocop to do it's business. For now, I decided to leave it out.
More reading: rubocop/rubocop#1747
For the future, we could configure it to prefer or allow the perl_names
which are the non-english, shortcut versions that we are already using like $?
and $&
etc.
…nventions Run autocorrections using c5-conventions/rubocop
Followup PR #153 addresses remaining non-auto-correct able issues. |
Problem ------- More dog-fooding. We want to promote the use of our carbonfive/c5-conventions rubocop file. Let's use it here. Solution -------- * Copy the carbonfive/c5-conventions `.rubocop.yml` into place * Remove `rubocop-performance` because we don't *really* need it and it'd require adding another gem dev depenency - seems overkill for it's possible benefit on *this* project * Add `lib/tasks` to `rakelib` * Add `rubocop.rake` file to get the `rubocop` and `rubocop:autocorrect` tasks * Run rubocop:autocorrect which cleaned a few things in bin/raygun NOTE ---- This repo is *still* not rubocop clean. There are several not-autofixable issues that could (should?) be addressed once this is approved.
9b6788b
to
ca91fbf
Compare
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.
🚀
Problem
More dog-fooding. We want to promote the use of our carbonfive/c5-conventions
rubocop file. Let's use it here.
Solution
.rubocop.yml
into placerubocop-performance
because we don't really need it andit'd require adding another gem dev depenency - seems overkill for it's
possible benefit on this project
lib/tasks
torakelib
rubocop.rake
file to get therubocop
andrubocop:autocorrect
tasks
NOTE
This repo is still not rubocop clean. There are several
not-autofixable issues that could (should?) be addressed once this is
approved.