-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix for new_cop rake task #6645
Conversation
I've never submitted a PR to a github repo before and I am not an experienced ruby developer, but the new_cop rake task would fail with:
until I put this fix in. |
@francoisa Thanks for your contribution. I tried the
FWIW, if
Please check again whether the problem is reproduced. Also, make sure that |
@francoisa Can you show me the full command when it's errored? e.g. I got the same error when the added cop's department does not exist, and the department is the last of dictionary order. $ bundle exec rake new_cop[Zzz/Aaa]
/home/pocke/.rbenv/versions/trunk/lib/ruby/gems/2.7.0/gems/parser-2.5.3.0/lib/parser/lexer.rb:10836: warning: assigned but unused variable - testEof
rake aborted!
TypeError: no implicit conversion from nil to integer
/home/pocke/ghq/github.com/rubocop-hq/rubocop/lib/rubocop/cop/generator/configuration_injector.rb:26:in `insert'
/home/pocke/ghq/github.com/rubocop-hq/rubocop/lib/rubocop/cop/generator/configuration_injector.rb:26:in `inject'
/home/pocke/ghq/github.com/rubocop-hq/rubocop/lib/rubocop/cop/generator.rb:136:in `inject_config'
tasks/new_cop.rake:20:in `block in <top (required)>'
/home/pocke/.rbenv/versions/trunk/bin/bundle:23:in `load'
/home/pocke/.rbenv/versions/trunk/bin/bundle:23:in `<main>'
Tasks: TOP => new_cop
(See full trace by running task with --trace)
[create] lib/rubocop/cop/zzz/aaa.rb
[create] spec/rubocop/cop/zzz/aaa_spec.rb |
Sorry for taking so long to reply. The command I used was:
I am using ruby 2.5.3. The steps I took were:
|
Thank you. I think this pull request has only a few problem. For example: $ bundle exec rake 'new_cop[Zzz/Aaa]'
$ git diff
diff --git a/config/default.yml b/config/default.yml
index da0926a63..e0be7a1a3 100644
--- a/config/default.yml
+++ b/config/default.yml
@@ -4304,6 +4304,11 @@ Style/YodaCondition:
VersionAdded: '0.49'
VersionChanged: '0.50'
+Zzz/Aaa:
+ Description: 'TODO: Write a description of the cop.'
+ Enabled: true
+ VersionAdded: '0.63'
+
Style/ZeroLengthPredicate:
Description: 'Use #empty? when testing for objects of length 0.'
Enabled: true I guess |
Code refactored. |
@pocke Are you okay with the changes? I'm ready to merge this if you think it's okay. 🙂 |
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.
Thank you!
The build on AppVeyor is faled, but I think we can ignore the failure because it only a network problem.
@Drenmi I think it's ready to merge. Thanks! |
Thank you, @francoisa! 🙇 |
Replace this text with a summary of the changes in your PR.
The more detailed you are, the better.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.