Split up .rubocop_todo.yml into .rubocop_todo/**/*.yml
Problem
RuboCop's TODOs .rubocop_todo.yml
is huge and contains (almost) all offenses which need to be fixed.
In !72791 (merged) we've started splitting TODOs into .rubocop_todo/**/*.yml
. One file per cop .rubocop_manual_todo.yml
. See Clarify the usage of RuboCop's generated and ma... (#294273 - closed)
In #354328 (closed) we've added the ability to rake rubocop:todo:generate
creating TODOs in .rubocop_todo/
.
Proposed solution
Split .rubocop_todo.yml
into .rubocop_todo/**/*.yml
with one file cop
- Pick a
👮 offense from the list below. For example,Gitlab/PolicyRuleBoolean
. - Create a well-named branch
354328-rubocop-todo-move-<Cop/Name>
.- For example,
354328-rubocop-todo-move-Gitlab/PolicyRuleBoolean
- Hint: Prefixing a branch name with an issue ID (
354328
) will add required labels and references to this issue in the new merge request.
- Hint: Prefixing a branch name with an issue ID (
- For example,
- Generate a TODO file for this cop via
rake 'rubocop:todo:generate[<Cop/Name>]'
first.- For example,
rake 'rubocop:todo:generate[Gitlab/PolicyRuleBolean]'
- For example,
- Delete the rule from
.rubocop_todo.yml
afterwards.- It's important to remove the rule only after running
rake
command above so disabled rules are kept disabled. - In MR it can be discussed to re-enable them again.
- It's important to remove the rule only after running
- Commit changes for both
.rubocop_todo.yml
and.rubocop_todo/<cop>/<name>.yml
files.- Hint: You can use
Move <Cop/Name> into separate TODO file
as git commit message - Hint: Community contributions can use git trailer
Changelog: other
so they are attributed inCHANGELOG.md
- Hint: You can use
- Create a merge request
- Mention this merge request next to the cop offense in the list below.
🎉
List
-
Capybara/VisibilityMatcher
-⚠ Disabled !82099 (merged) -
Gitlab/PolicyRuleBoolean
- !87568 (merged) -
Layout/ArgumentAlignment
-⚠ Disabled !82600 (merged) -
Layout/FirstArrayElementIndentation
-⚠ Disabled !82601 (merged) -
Layout/FirstHashElementIndentation
-⚠ Disabled !82605 (merged) -
Layout/HashAlignment
-⚠ Disabled !82606 (merged) -
Layout/LineLength
!83176 (merged) -
Layout/MultilineOperationIndentation
-⚠ Disabled !84570 (merged) -
Layout/SpaceAroundMethodCallOperator
-⚠ Disabled !84574 (merged) -
Layout/SpaceInLambdaLiteral
-⚠ Disabled !84575 (merged) -
Layout/SpaceInsideBlockBraces
-⚠ Disabled !84577 (merged) -
Layout/SpaceInsideParens
-⚠ Disabled !84580 (merged) -
Lint/BinaryOperatorWithIdenticalOperands
!84458 (merged) -
Lint/ConstantDefinitionInBlock
-⚠ Disabled !84582 (merged) -
Lint/EmptyFile
- !86133 (merged) -
Lint/MissingCopEnableDirective
-⚠ Disabled !84585 (merged) -
Lint/MixedRegexpCaptureTypes
!83738 (merged) -
Lint/RedundantCopDisableDirective
-⚠ Disabled -
Fix Link/SelfAssignment offense (!83581 - merged)Lint/SelfAssignment
-
Lint/StructNewOverride
Move Lint/StructNewOverride into separate TODO ... (!83586 - merged) -
Lint/UselessMethodDefinition
-⚠ Disabled - !86161 (merged) -
Metrics/AbcSize
!83177 (merged) -
Metrics/CyclomaticComplexity
!83178 (merged) -
Metrics/PerceivedComplexity
!83179 (merged) -
Naming/HeredocDelimiterCase
!83590 (merged) -
Naming/HeredocDelimiterNaming
-⚠ Disabled !85404 (merged) -
Naming/RescuedExceptionsVariableName
-⚠ Disabled !86918 (merged) -
Performance/AncestorsInclude
- !86347 (merged) -
Performance/BlockGivenWithExplicitBlock
-⚠ Disabled !85406 (merged) -
Performance/CollectionLiteralInLoop
-⚠ Disabled !86919 (merged) -
Performance/ConstantRegexp
-⚠ Disabled !86920 (merged) -
Resolve Performance/DeleteSuffix rubocop offenses (!81344 - merged)Performance/DeletePrefix
-
Performance/MethodObjectAsBlock
-⚠ Disabled !85407 (merged) -
Performance/StringInclude
!83943 (merged) -
RSpec/ContextWording
-⚠ Disabled !86921 (merged) -
RSpec/EmptyExampleGroup
!83942 (merged) -
RSpec/ExpectChange
-⚠ Disabled !86922 (merged) -
RSpec/ExpectInHook
-⚠ Disabled !85411 (merged) -
RSpec/PredicateMatcher
-⚠ Disabled !86923 (merged) -
RSpec/RepeatedExampleGroupBody
-⚠ Disabled !86924 (merged) -
RSpec/RepeatedExampleGroupDescription
-⚠ Disabled !85490 (merged) -
RSpec/ReturnFromStub
-⚠ Disabled !86926 (merged) -
RSpec/ScatteredLet
-⚠ Disabled !86927 (merged) -
Fix RSpec/VariableDefinition rubocop offense (!83956 - merged)RSpec/VariableDefinition
-
Fix RSpec/VariableName rubocop offense (!84354 - merged)RSpec/VariableName
-
Rails/ActiveRecordCallbacksOrder
-⚠ Disabled !86929 (merged) -
Rails/ApplicationController
~~ !87477 (merged) -
Resolve Rails/BelongsTo rubocop offenses (!81382 - merged)Rails/BelongsTo
-
Rails/ContentTag
-⚠ Disabled !86930 (merged) -
Rails/CreateTableWithTimestamps
-⚠ Disabled !86931 (merged) -
Rails/FilePath
-⚠ Disabled !86932 (merged) -
Rails/FindById
-
Rails/HasManyOrHasOneDependent
-⚠ Disabled !86933 (merged) -
Rails/HelperInstanceVariable
-⚠ Disabled !86934 (merged) -
Rails/IndexWith
-⚠ Disabled !86936 (merged) -
Rails/Inquiry
!83945 (merged) -
Rails/InverseOf
-⚠ Disabled !86938 (merged) -
Rails/LexicallyScopedActionFilter
-⚠ Disabled !86939 (merged) -
Rails/MailerName
!83950 (merged) -
Rails/NegateInclude
-⚠ Disabled !86940 (merged) -
Rails/Pick
-⚠ Disabled !86942 (merged) -
Rails/Pluck
-⚠ Disabled !86011 (merged) -
Rails/RakeEnvironment
-⚠ Disabled !86943 (merged) -
Rails/RedundantForeignKey
-⚠ Disabled !86945 (merged) -
Rails/RenderInline
!83939 (merged) -
Rails/SkipsModelValidations
-⚠ Disabled !86008 (merged) -
Rails/SquishedSQLHeredocs
-⚠ Disabled !86947 (merged) -
Rails/WhereExists
-⚠ Disabled !86949 (merged) -
Style/AccessorGrouping
-⚠ Disabled !86953 (merged) -
Style/ArrayCoercion
!83838 (merged) -
Style/BarePercentLiterals
-⚠ Disabled !86954 (merged) -
Fix Style/BisectedAttrAccessor offenses (!83834 - merged)Style/BisectedAttrAccessor
-
Style/CaseLikeIf
-⚠ Disabled !86955 (merged) -
Style/CombinableLoops
!83825 (merged) -
Fix Style/EachWithObject offenses (!83823 - merged)Style/EachWithObject
-
Style/EmptyElse
-⚠ Disabled !86005 (merged) -
Style/EmptyMethod
-⚠ Disabled !86957 (merged) -
Style/ExpandPathArguments
!83728 (merged) -
Style/ExplicitBlockArgument
-⚠ Disabled !86443 (merged) -
Style/FormatString
-⚠ Disabled !86959 (merged) -
Style/GuardClause
-⚠ Disabled !86004 (merged) -
Style/HashAsLastArrayItem
-⚠ Disabled !86961 (merged) -
Style/HashEachMethods
-⚠ Disabled !86963 (merged) -
Style/IfInsideElse
-⚠ Disabled !86441 (merged) -
Style/IfUnlessModifier
-⚠ Disabled !86002 (merged) -
Style/KeywordParametersOrder
-⚠ Disabled !86964 (merged) -
Style/Lambda
-⚠ Disabled !86965 (merged) -
Style/MissingRespondToMissing
-⚠ Disabled !86001 (merged) -
Fix Style/MixinUsage offenses (!83594 - merged)Style/MixinUsage
-
Style/Next
-⚠ Disabled !86438 (merged) -
Style/NumericLiteralPrefix
-⚠ Disabled !86966 (merged) -
Style/PercentLiteralDelimiters
-⚠ Disabled !85996 (merged) -
Fix Style/RedundantFetchBlock rubocop offence (!82093 - merged)Style/RedundantFetchBlock
-
Style/RedundantInterpolation
-⚠ Disabled !86967 (merged) -
Style/RedundantRegexpEscape
-⚠ Disabled !86968 (merged) -
Style/RedundantSelf
-⚠ Disabled !85993 (merged) -
Style/RescueModifier
-⚠ Disabled !86436 (merged) -
Style/SingleArgumentDig
-⚠ Disabled !86969 (merged) -
Style/SoleNestedConditional
-⚠ Disabled !86000 (merged) -
Style/SpecialGlobalVars
!83725 (merged) -
Style/StringConcatenation
-⚠ Disabled !86971 (merged) -
Style/StringLiteralsInInterpolation
-⚠ Disabled !86433 (merged) -
Style/SymbolProc
-⚠ Disabled !85998 (merged)
⚠ Disabled cop rules
Some cop rules have been disabled (via Enabled: false
) in .rubocop_todo.yml
because they exceeded the amount of allowed offenses (15).
When moving cop rule exclusions from .rubocop_todo.yml
into .rubocop_todo/**/*.yml
they remain disabled.
Non-controversial rules (e.g. amount of offenses is not too high) can be enabled immediately.
Rules with a huge amount of offenses, for example, Layout/ArgumentAlignment
or Layout/HashAlignment
require further discussion in the MR which moves the exclusions to .rubocop_todo/
.
See #354328 (comment 870464004) for more info!