-
-
Notifications
You must be signed in to change notification settings - Fork 43
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 new Minitest/LifecycleHooksOrder
cop
#232
Conversation
rubocop-minitest.gemspec
Outdated
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec| | |||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | |||
spec.require_paths = ['lib'] | |||
|
|||
spec.add_runtime_dependency 'rubocop', '>= 0.90', '< 2.0' | |||
spec.add_runtime_dependency 'rubocop', '>= 1.43', '< 2.0' |
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.
Upgraded rubocop because I need range_with_comments_and_lines
from RangeHelp
module.
Probably better done as a separate PR?
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.
It's a big jump, but let's still include it in this PR. By the way, it looks like this was introduced in 1.39, not 1.43.
rubocop/rubocop@0d6b0d1
spec.add_runtime_dependency 'rubocop', '>= 1.43', '< 2.0' | |
spec.add_runtime_dependency 'rubocop', '>= 1.39', '< 2.0' |
MSG = '`%<current>s` is supposed to appear before `%<previous>s`.' | ||
|
||
HOOKS_ORDER_MAP = Hash.new do |hash, hook| | ||
hash[hook] = LIFECYCLE_HOOK_METHODS_IN_ORDER.index(hook) || 100 |
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.
Can you make the magic number 100
a constant and add an explanation of what it is?
b2f3788
to
49bdd91
Compare
Updated. |
|
||
MSG = '`%<current>s` is supposed to appear before `%<previous>s`.' | ||
|
||
REGULAR_METHOD_POSITION = 100 |
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.
It would be better if source commented why the value of 100
was chosen and set :-)
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.
Updated.
49bdd91
to
a028c03
Compare
Thanks! |
Closes #214.
Tested on
rails/rails
- 5 valid offenses.