Enable new cops by default
In !119 (merged), I set NewCops: disable
to avoid making the upgrade MR too big. However, we should probably take new cops by default?
List
-
Layout/SpaceBeforeBrackets
- !139 (merged) -
Gemspec/DeprecatedAttributeAssignment
# new in 1.30 -
Gemspec/RequireMFA
# new in 1.23 -
Layout/LineContinuationLeadingSpace
- !139 (merged) -
Lint/AmbiguousAssignment
- !141 (merged) -
Lint/AmbiguousOperatorPrecedence
- !141 (merged) -
Lint/AmbiguousRange
- !141 (merged) -
Lint/ConstantOverwrittenInRescue
- !141 (merged) -
Lint/DeprecatedConstants
- !141 (merged) -
Lint/DuplicateBranch
- !141 (merged) -
Lint/DuplicateMagicComment
- !141 (merged) -
Lint/DuplicateRegexpCharacterClassElement
- !141 (merged) -
Lint/EmptyBlock
- !141 (merged) -
Lint/EmptyClass
- !141 (merged) -
Lint/EmptyInPattern
- !141 (merged) -
Lint/IncompatibleIoSelectWithFiberScheduler
- !160 (merged) -
Lint/LambdaWithoutLiteralBlock
- !160 (merged) -
Lint/NoReturnInBeginEndBlocks
- !160 (merged) -
Lint/NonAtomicFileOperation
- !160 (merged) -
Lint/NumberedParameterAssignment
- !160 (merged) -
Lint/OrAssignmentToConstant
- !160 (merged) -
Lint/RedundantDirGlobSort
- !160 (merged) -
Lint/RefinementImportMethods
- !160 (merged) -
Lint/RequireRangeParentheses
- !160 (merged) -
Lint/RequireRelativeSelfPath
- !160 (merged) -
Lint/SymbolConversion
- !160 (merged) -
Lint/ToEnumArguments
- !160 (merged) -
Lint/TripleQuotes
- !160 (merged) -
Lint/UnexpectedBlockArity
- !160 (merged) -
Lint/UnmodifiedReduceAccumulator
- !160 (merged) -
Lint/UselessRuby2Keywords
- !160 (merged) -
Naming/BlockForwarding
# new in 1.24 -
Performance/ConcurrentMonotonicTime
- !138 (merged) -
Performance/MapCompact
- !138 (merged) -
Performance/RedundantEqualityComparisonBlock
- !138 (merged) -
Performance/RedundantSplitRegexpArgument
- !138 (merged) -
Performance/StringIdentifierArgument
- !138 (merged) -
RSpec/BeEq
# new in 2.9.0 -
RSpec/BeNil
# new in 2.9.0 -
RSpec/Capybara/NegationMatcher
# new in 2.14 -
RSpec/Capybara/SpecificActions
# new in 2.14 -
RSpec/Capybara/SpecificMatcher
# new in 2.12 -
RSpec/ChangeByZero
# new in 2.11.0 -
RSpec/DuplicatedMetadata
# new in 2.16 -
RSpec/ExcessiveDocstringSpacing
# new in 2.5 -
RSpec/FactoryBot/ConsistentParenthesesStyle
# new in 2.14 -
RSpec/FactoryBot/FactoryNameStyle
# new in 2.16 -
RSpec/FactoryBot/SyntaxMethods
# new in 2.7 -
RSpec/IdenticalEqualityAssertion
# new in 2.4 -
RSpec/NoExpectationExample
# new in 2.13 -
RSpec/PendingWithoutReason
# new in 2.16 -
RSpec/Rails/AvoidSetupHook
# new in 2.4 -
RSpec/Rails/HaveHttpStatus
# new in 2.12 -
RSpec/Rails/InferredSpecType
# new in 2.14 -
RSpec/SortMetadata
# new in 2.14 -
RSpec/SubjectDeclaration
# new in 2.5 -
RSpec/VerifiedDoubleReference
# new in 2.10.0 -
Rails/ActionControllerFlashBeforeRender
# new in 2.16 -
Rails/ActionControllerTestCase
# new in 2.14 -
Rails/ActionOrder
# new in 2.17 -
Rails/ActiveSupportOnLoad
# new in 2.16 -
Rails/AddColumnIndex
# new in 2.11 -
Rails/CompactBlank
# new in 2.13 -
Rails/DeprecatedActiveModelErrorsMethods
# new in 2.14 -
Rails/DotSeparatedKeys
# new in 2.15 -
Rails/DuplicateAssociation
# new in 2.14 -
Rails/DuplicateScope
# new in 2.14 -
Rails/DurationArithmetic
# new in 2.13 -
Rails/EagerEvaluationLogMessage
# new in 2.11 -
Rails/ExpandedDateRange
# new in 2.11 -
Rails/FreezeTime
# new in 2.16 -
Rails/I18nLazyLookup
# new in 2.14 -
Rails/I18nLocaleAssignment
# new in 2.11 -
Rails/I18nLocaleTexts
# new in 2.14 -
Rails/IgnoredColumnsAssignment
# new in 2.17 -
Rails/MigrationClassName
# new in 2.14 -
Rails/RedundantPresenceValidationOnBelongsTo
# new in 2.13 -
Rails/RedundantTravelBack
# new in 2.12 -
Rails/RootJoinChain
# new in 2.13 -
Rails/RootPathnameMethods
# new in 2.16 -
Rails/RootPublicPath
# new in 2.15 -
Rails/StripHeredoc
# new in 2.15 -
Rails/TimeZoneAssignment
# new in 2.10 -
Rails/ToFormattedS
# new in 2.15 -
Rails/ToSWithArgument
# new in 2.16 -
Rails/TopLevelHashWithIndifferentAccess
# new in 2.16 -
Rails/TransactionExitStatement
# new in 2.14 -
Rails/UnusedIgnoredColumns
# new in 2.11 -
Rails/WhereMissing
# new in 2.16 -
Rails/WhereNotWithMultipleConditions
# new in 2.17 -
Security/CompoundHash
- !150 (merged) -
Security/IoMethods
- !128 (merged) -
Style/ArgumentsForwarding
# new in 1.1 -
Style/ArrayIntersect
# new in 1.40 -
Style/CollectionCompact
# new in 1.2 -
Style/ConcatArrayLiterals
# new in 1.41 -
Style/DocumentDynamicEvalDefinition
# new in 1.1 -
Style/EmptyHeredoc
# new in 1.32 -
Style/EndlessMethod
# new in 1.8 -
Style/EnvHome
# new in 1.29 -
Style/FetchEnvVar
# new in 1.28 -
Style/FileRead
# new in 1.24 -
Style/FileWrite
# new in 1.24 -
Style/HashConversion
# new in 1.10 -
Style/HashExcept
# new in 1.7 -
Style/IfWithBooleanLiteralBranches
# new in 1.9 -
Style/InPatternThen
# new in 1.16 -
Style/MagicCommentFormat
# new in 1.35 -
Style/MapCompactWithConditionalBlock
# new in 1.30 -
Style/MapToHash
# new in 1.24 -
Style/MapToSet
# new in 1.42 -
Style/MinMaxComparison
# new in 1.42 -
Style/MultilineInPatternThen
# new in 1.16 -
Style/NegatedIfElseCondition
# new in 1.2 -
Style/NestedFileDirname
# new in 1.26 -
Style/NilLambda
# new in 1.3 -
Style/NumberedParameters
- !153 (merged) -
Style/NumberedParametersLimit
# new in 1.22 -
Style/ObjectThen
# new in 1.28 -
Style/OperatorMethodCall
# new in 1.37 -
Style/QuotedSymbols
# new in 1.16 -
Style/RedundantArgument
# new in 1.4 -
Style/RedundantConstantBase
# new in 1.40 -
Style/RedundantDoubleSplatHashBraces
# new in 1.41 -
Style/RedundantEach
# new in 1.38 -
Style/RedundantInitialize
# new in 1.27 -
Style/RedundantSelfAssignmentBranch
# new in 1.19 -
Style/RedundantStringEscape
# new in 1.37 -
Style/SelectByRegexp
# new in 1.22 -
Style/StringChars
# new in 1.12 -
Style/SwapValues
# new in 1.1 -
Style/YodaExpression
# new in 1.42
Updating the list
- Copy this
👇 script and save asmerge.rb
# frozen_string_literal: true
require "active_support/all"
BULLET_REGEXP = %r{^- \[.\] `(\S+)` (?:-|#)}
WARNINGS_REGEXP = %r{^(\S+): (# new.*)}
# Copy existing bullet point list (markdown) from
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/40 as `bullets`.
bullets = File
.readlines("bullets")
.index_by { BULLET_REGEXP.match(_1)&.captures&.first }
.compact
# Run `bundle exec rubocop --show-cops 2>warnings`.
File
.readlines("warnings")
.to_h { WARNINGS_REGEXP.match(_1)&.captures || [nil, nil] }
.compact
.each do |cop_name, comment|
bullets[cop_name] ||= "- [ ] `#{cop_name}` #{comment}"
end
content = bullets.sort_by { |(k, _)| k || "?" }.map { _2.chomp }.join("\n")
File.write("bullets.new", content)
puts "Written bullets.new"
- Copy existing bullet points as markdown into
bullets
file - Comment
NewCops: disable
in.rubocop.yml
and runbundle exec rubocop --show-cops 2> warnings
- Run
bundle exec ruby merge.rb
- Paste
bullets.new
into this issue description
Edited by Peter Leitzen