Faraday: RuboCop Quest Issue

Created on 20 Feb 2019  ·  5Comments  ·  Source: lostisland/faraday

Basic Info

We are linting the whole codebase using RuboCop.

This is a list of all the rules in the .rubocop_todo.yml when we started. The checkmarks mean "this is fixed and merged to master".

If you create a PR to fix one of these, use the --only option in RuboCop, to focus the effort on 1 kind of fix. It's so easy to get overwhelmed when reviewing code like this. (If you fix slightly more than that, no biggie. This is all about keeping the changes reviewable.)

# edit .rubocop.yml, commenting out the first line -
#   this removes the "ignore the TODOs" setting

# Auto-correct with only 1 rule
rubocop -a --only Name/OfTheRuleYouAreFixing --auto-correct

# Re-generate the config file
rubocop --auto-gen-config

# Revert line 3 in .rubocop_todo.yml
# This will avoid PR conflicts

# Inspect to see if it looks OK
git diff

# Re-set the TODO list
git checkout .rubocop.yml

# Add and commit the change
git add .
git commit -m"chore: RuboCop lint Name/OfTheRuleYouAreFixing"

A workflow

Issue description

  • [x] Bundler/OrderedGems #856
  • [x] Layout/AccessModifierIndentation #862
  • [x] Layout/AlignHash #863
  • [x] Layout/AlignParameters #867
  • [x] Layout/BlockEndNewline
  • [x] Layout/CaseIndentation #864
  • [x] Layout/CommentIndentation #864
  • [x] Layout/DotPosition #880
  • [x] Layout/ElseAlignment #871
  • [x] Layout/EmptyLineAfterGuardClause #860
  • [x] Layout/EmptyLineBetweenDefs #860
  • [x] Layout/EmptyLines #860
  • [x] Layout/EmptyLinesAroundAccessModifier #881
  • [x] Layout/EmptyLinesAroundClassBody #882
  • [x] Layout/EndAlignment #887
  • [x] Layout/ExtraSpacing #884
  • [x] Layout/IndentArray #890
  • [x] Layout/IndentHash #890
  • [x] Layout/IndentationWidth #864
  • [x] Layout/LeadingCommentSpace #860
  • [x] Layout/MultilineBlockLayout
  • [x] Layout/MultilineMethodCallIndentation #864
  • [x] Layout/MultilineOperationIndentation #864
  • [x] Layout/RescueEnsureAlignment #890
  • [x] Layout/SpaceAfterComma #884
  • [x] Layout/SpaceAroundEqualsInParameterDefault #884
  • [x] Layout/SpaceAroundOperators #884
  • [x] Layout/SpaceBeforeBlockBraces #884
  • [x] Layout/SpaceInsideArrayLiteralBrackets #884
  • [x] Layout/SpaceInsideBlockBraces #884
  • [x] Layout/SpaceInsideHashLiteralBraces #884
  • [x] Layout/SpaceInsideParens #884
  • [x] Layout/SpaceInsidePercentLiteralDelimiters #884
  • [x] Layout/TrailingBlankLines #872
  • [x] Layout/TrailingWhitespace
  • [x] Lint/AssignmentInCondition #874
  • [x] Lint/HandleExceptions #896
  • [x] Lint/ReturnInVoidContext #896
  • [x] Lint/StringConversionInInterpolation #891
  • [x] Lint/UnneededRequireStatement #896
  • [x] Lint/UnusedBlockArgument #896
  • [x] Lint/UnusedMethodArgument #896
  • [x] Lint/UselessAssignment #891
  • [x] Lint/Void #896
  • [x] _Postponed indefinitely_ ~Metrics/AbcSize~
  • [x] Metrics/BlockLength #883 #927
  • [x] _Postponed indefinitely_ ~Metrics/ClassLength #944~
  • [x] _Postponed indefinitely_ ~Metrics/CyclomaticComplexity~
  • [x] _Postponed indefinitely_ ~Metrics/MethodLength~
  • [x] _Postponed indefinitely_ ~Metrics/ModuleLength~
  • [x] _Postponed indefinitely_ ~Metrics/PerceivedComplexity~
  • [x] Naming/ConstantName #897
  • [x] Naming/MemoizedInstanceVariableName #891
  • [x] Naming/PredicateName #897
  • [x] Naming/UncommunicativeMethodParamName #897
  • [x] Performance/RedundantBlockCall #897
  • [x] Performance/StringReplacement #897
  • [x] Style/AccessModifierDeclarations #897
  • [x] Style/Alias #897
  • [x] Style/AndOr #897
  • [x] Style/BlockDelimiters #906
  • [x] Style/BracesAroundHashParameters #907
  • [x] Style/CaseEquality #902
  • [x] Style/ClassAndModuleChildren #902
  • [x] Style/ClassCheck #902
  • [x] Style/ClassVars #933
  • [x] Style/ColonMethodCall #894
  • [x] Style/CommentAnnotation #876
  • [x] Style/ConditionalAssignment #902
  • [x] Style/Documentation
  • [x] Style/DoubleNegation #922
  • [x] Style/EachWithObject #901
  • [x] Style/EmptyMethod #912
  • [x] Style/ExpandPathArguments #901
  • [x] Style/FormatString #901
  • [x] Style/FormatStringToken #914
  • [x] Style/FrozenStringLiteralComment #868
  • [x] Style/GlobalVars #943
  • [x] Style/GuardClause #931
  • [x] Style/HashSyntax #878
  • [x] Style/IfInsideElse #915
  • [x] Style/IfUnlessModifier #926
  • [x] Style/Lambda #901
  • [x] Style/MethodMissingSuper #928
  • [x] Style/MissingRespondToMissing #930
  • [x] Style/ModuleFunction #925
  • [x] Style/MultilineIfModifier #924
  • [x] Style/MultilineTernaryOperator #913
  • [x] Style/MultipleComparison #923
  • [x] Style/MutableConstant #925
  • [x] Style/NegatedIf #901
  • [x] Style/NestedParenthesizedCalls #901
  • [x] Style/Next #901
  • [x] Style/NilComparison #921
  • [x] Style/Not #901
  • [x] Style/NumericPredicate #921
  • [x] Style/ParallelAssignment #920
  • [x] Style/ParenthesesAroundCondition #920
  • [x] Style/PercentLiteralDelimiters #905
  • [x] Style/PerlBackrefs #920
  • [x] Style/PreferredHashMethods #920
  • [x] Style/Proc #920
  • [x] Style/RaiseArgs #910
  • [x] Style/RedundantException #895
  • [x] Style/RedundantParentheses #895
  • [x] Style/RedundantReturn #895
  • [x] Style/RedundantSelf #895
  • [x] Style/RegexpLiteral #910
  • [x] Style/RescueStandardError #910
  • [x] Style/SafeNavigation #909
  • [x] Style/Semicolon #908
  • [x] Style/SingleLineMethods #909
  • [x] Style/SpecialGlobalVars #909
  • [x] Style/StderrPuts #908
  • [x] Style/StringLiterals #874
  • [x] Style/StringLiteralsInInterpolation #909
  • [x] Style/StructInheritance #904
  • [x] Style/SymbolArray #898
  • [x] Style/SymbolProc #898
  • [x] Style/TernaryParentheses #898
  • [x] Style/TrailingCommaInArrayLiteral #859
  • [x] Style/TrailingCommaInHashLiteral #859
  • [x] Style/TrivialAccessors #898
  • [x] Style/UnlessElse #898
  • [x] Style/WordArray #893
  • [x] Style/YodaCondition #898
  • [x] Style/ZeroLengthPredicate #858
  • [x] Metrics/LineLength #938
help wanted

Most helpful comment

Thanks, everyone! 🚀

All 5 comments

Removing this comment. My previous assertion was wrong. Future devs should note that .rubocop_todo.yml file when checking for violations.

The current master ref has some rubocop violations not being caught by CI. Those issues are fixed in https://github.com/lostisland/faraday/pull/870 and https://github.com/lostisland/faraday/pull/871.

Also, if PRs are named something like [RuboCop] fix Layout/TrailingBlankLines, then they'll be much easier to add to the above checklist.

I checked off Style/GlobalVars because the only offender is script/generate_certs. Once the old integration tests have fully been ported, the old scripts for the integration suite can go, and this offense will be magically fixed. Any other global vars added elsewhere should continue to be flagged as rubocop offenses.

I hadn't seen this post before I fixed the Style/Globalvars :man_shrugging:

Thanks, everyone! 🚀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yarafan picture yarafan  ·  9Comments

alfius picture alfius  ·  11Comments

JohnBat26 picture JohnBat26  ·  11Comments

auxbuss picture auxbuss  ·  9Comments

janpio picture janpio  ·  15Comments