shoes4 icon indicating copy to clipboard operation
shoes4 copied to clipboard

Getting rid of rubocop offenses

Open PragTob opened this issue 10 years ago • 11 comments

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.

PragTob avatar Nov 14 '14 12:11 PragTob

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!

zmackie avatar Dec 02 '14 02:12 zmackie

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:

jasonrclark avatar Dec 02 '14 02:12 jasonrclark

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!

PragTob avatar Dec 02 '14 08:12 PragTob

@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.

ybur-yug avatar Apr 27 '15 01:04 ybur-yug

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

PragTob avatar Apr 28 '15 17:04 PragTob

For the cops that seem questionable, should I ask about them here inline or open new tickets for each one?

jaredmoody avatar May 06 '15 05:05 jaredmoody

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.

jasonrclark avatar May 06 '15 05:05 jasonrclark

:+1:

PragTob avatar May 06 '15 05:05 PragTob

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.

jaredmoody avatar Nov 04 '16 08:11 jaredmoody

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 .

submitnine avatar Oct 03 '18 17:10 submitnine

Totally still valid! Thanks @submitnine.

jasonrclark avatar Oct 03 '18 17:10 jasonrclark