shoes4
shoes4 copied to clipboard
Getting rid of rubocop offenses
Rubocop is a tool that automatically checks for ruby style violations. We ran an autofix but still got a couple of them in here.
If you want, you can help by getting rid of a couple of them, which would be appreciated :+1:
Here is a nice website that shows an overview: http://www.refactorcop.com/shoes/shoes4
In case we don't like some of them, we might also deactivate them so rubocop doesn't scan for them any more.
Here is a current list of the offenses we have, generated through rubocop lib/ --format offenses -D --out rubocop_offenses.txt
:
177 Style/Documentation
172 Metrics/LineLength
51 Metrics/AbcSize
46 Metrics/MethodLength
23 Lint/AmbiguousOperator
20 Metrics/ParameterLists
20 Style/CaseIndentation
17 Style/GuardClause
13 Style/TrivialAccessors
12 Lint/UselessAssignment
10 Metrics/ClassLength
9 Style/AccessorMethodName
9 Style/Semicolon
7 Metrics/CyclomaticComplexity
6 Style/PredicateName
5 Style/FormatString
4 Style/GlobalVars
4 Style/IfUnlessModifier
3 Metrics/PerceivedComplexity
3 Style/EvenOdd
3 Style/RegexpLiteral
2 Lint/Eval
2 Lint/RequireParentheses
2 Lint/ShadowingOuterLocalVariable
2 Lint/UselessAccessModifier
2 Style/NestedTernaryOperator
2 Style/SelfAssignment
1 Lint/RescueException
1 Lint/UnderscorePrefixedVariableName
1 Style/AsciiComments
1 Style/Blocks
1 Style/CommentAnnotation
1 Style/ConstantName
1 Style/EndOfLine
1 Style/FileName
1 Style/MultilineBlockChain
1 Style/OpMethod
1 Style/SingleLineBlockParams
1 Style/UnlessElse
--
638 Total
And here is a gist with a detailed analysis of what went wrong generated through rubocop lib/ -D --out rubocop.txt
rubocop gist
Some time I'll probably go and check out the linting ones and others.
Hey Tobias. I've forked this and am going to get started squashing these. This'll be my first open-source contrib so I'm very excited!
Hurray, thanks for the help @Zanadar!
If you didn't pull already this afternoon, highly recommend you do before you start. We just merged an epic file move, and would hate for your efforts to hit unneeded merge conflicts!
Shoes on! :sparkles:
Hey @Zanadar that sounds amazing! Looking forward to your contribution very much :)
I just checked and your fork has the state from after the epic file move, so that is good - get squashing away! Also, feel free to do early pull requests :) We love to review and refine together!
Thanks!
@Zanadar Have you got a PR youre still going to submit or have you stopped working on it? I was planning on hopping onto it myself.
I don't see changes on the repo so I think it's safe to hack on it :) Also, there are enough rubocop offences for everyone :D
Tobi
For the cops that seem questionable, should I ask about them here inline or open new tickets for each one?
We did a basic review of the rules when we opened this and excluded the ones we clearly didn't want, but it's very possible others are questionable. I'd say go for it with separate issues/PR's for any that you've got question on. That's a great way to discuss them.
:+1:
Note for anyone wanting to contribute to this issue:
All existing violations are recorded in .rubocop-todo.yml
. To get started, run rubocop
and all checks should pass. Then remove the cop you would like to fix from .rubocop-todo.yml
. After fixing all violations, rubocop
checks should all pass once again.
Hi, even the Hacktoberfest label is from the last year, it should be valid to fix some rubocop offenes, right? :) May my tiny PR can help a little bit. #1568 .
Totally still valid! Thanks @submitnine.