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
Cop idea: change example length from counting lines to statements #249
Comments
I think line length and statement complexity are probably both decent heuristics with edge cases that will be obviously wrong in some cases. What do you think abuot a separate cop instead like |
Now that I'm looking at this I'm wondering if just using rubocop's built-in |
FWIW, rubocop's line number cops now allow exceptions for hashes, arrays, and heredocs. Perhaps it's abstracted enough that this cop could take advantage of it as well. See here |
Since ExampleLength supports the CountAsOne option for arrays and hashes, perhaps we can close this? |
Makes sense 👍 @bquorning ? |
Yes, I agree. As @Darhazer mentioned, the RSpec/ExampleLength cop can be configured with the Update: the |
Example:
This has 3 statements, which seems like a reasonable number for an example. But due to the way it's formatted (which I believe contributes to good readability *) it has 17 lines, which causes the cop to fail. Would it be possible to count the number of statements instead of lines?
* Kevlin Henney - Seven Ineffective Coding Habits of Many Programmers https://vimeo.com/97329157#t=14:36
The text was updated successfully, but these errors were encountered: