-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 cop for block length #3566
Labels
Comments
bbatsov
added
feature request
good first issue
Easy task, suitable for newcomers to the project
labels
Oct 2, 2016
You don't really need any pattern matching to write this. You just have to process |
savef
added a commit
to savef/rubocop
that referenced
this issue
Oct 8, 2016
This cop checks there aren't too many lines in blocks, much like `Metric/MethodLength` checks for too many lines in methods. Also removed the splatted additional args from CodeLength#check_code_length, I don't think they've been necessary since the old `check` method was refactored into that method.
Awesome, thanks for implementing this! 😀 |
alexjfisher
added a commit
to alexjfisher/modulesync_config
that referenced
this issue
Oct 14, 2016
`Metric/BlockLength` is a new cop in rubocop 0.44. rubocop/rubocop#3566 All puppet type definitions occur in blocks that are almost always longer than 25 lines. I don't see much benefit in having the cop enabled, and then having to disable it with control comments instead. Signed-off-by: Alexander Fisher <alex@linfratech.co.uk>
Neodelf
pushed a commit
to Neodelf/rubocop
that referenced
this issue
Oct 15, 2016
This cop checks there aren't too many lines in blocks, much like `Metric/MethodLength` checks for too many lines in methods. Also removed the splatted additional args from CodeLength#check_code_length, I don't think they've been necessary since the old `check` method was refactored into that method.
Is there an easy way to disable this cop for RSpec tests but keep it enabled for all other codes? |
You can exclude your |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I would like a cop like Metrics/MethodLength but for blocks (as in
do...end
or{...}
). I think this would be especially useful when using frameworks like Sinatra or Rake that heavily use methods with block parameters. (namespace
,task
, etc. in Rake;get
,post
, etc. with Sinatra.)I am trying to implement this myself, but I'm getting a bit lost around AST-node pattern-matching.
RuboCop version
The text was updated successfully, but these errors were encountered: