rubocop: Set EnabledByDefault: true, disabling cops with offenses

- `EnabledByDefault` is a feature of RuboCop that enables all cops even
  those marked `Enabled: false` in core RuboCop.
- I went through and disabled all the cops with offenses from this
  config change. This way we can do a piecemeal approach to enabling
  cops with offenses, while getting the benefits of the new cops with
  no offenses.
- It is intentional that `brew style` comes back green here and there
  are no code style fixes.
This commit is contained in:
Issy Long 2023-04-26 00:17:19 +01:00
parent d0d0b7e6ee
commit 6527fc2785
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -14,6 +14,7 @@ inherit_mode:
AllCops: AllCops:
TargetRubyVersion: 2.6 TargetRubyVersion: 2.6
ActiveSupportExtensionsEnabled: true ActiveSupportExtensionsEnabled: true
EnabledByDefault: true
NewCops: enable NewCops: enable
Include: Include:
- "**/*.rbi" - "**/*.rbi"
@ -25,6 +26,12 @@ AllCops:
- "Homebrew/vendor/**/*" - "Homebrew/vendor/**/*"
- "Taps/*/*/vendor/**/*" - "Taps/*/*/vendor/**/*"
# TODO: This group of cops comes from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Bundler/GemComment:
Enabled: false
Bundler/GemVersion:
Enabled: false
Cask/Desc: Cask/Desc:
Description: "Ensure that the desc stanza conforms to various content and style checks." Description: "Ensure that the desc stanza conforms to various content and style checks."
Enabled: true Enabled: true
@ -69,6 +76,34 @@ Layout/ArgumentAlignment:
Layout/CaseIndentation: Layout/CaseIndentation:
EnforcedStyle: end EnforcedStyle: end
# TODO: This group of cops comes from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Layout/ClassStructure:
Enabled: false
Layout/EmptyLineAfterMultilineCondition:
Enabled: false
Layout/FirstArrayElementLineBreak:
Enabled: false
Layout/FirstHashElementLineBreak:
Enabled: false
Layout/FirstMethodArgumentLineBreak:
Enabled: false
Layout/FirstMethodParameterLineBreak:
Enabled: false
Layout/MultilineArrayLineBreaks:
Enabled: false
Layout/MultilineAssignmentLayout:
Enabled: false
Layout/MultilineHashKeyLineBreaks:
Enabled: false
Layout/MultilineMethodArgumentLineBreaks:
Enabled: false
Layout/MultilineMethodParameterLineBreaks:
Enabled: false
Layout/RedundantLineBreak:
Enabled: false
Layout/SingleLineBlockChain:
Enabled: false
# significantly less indentation involved; more consistent # significantly less indentation involved; more consistent
Layout/FirstArrayElementIndentation: Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent EnforcedStyle: consistent
@ -135,6 +170,12 @@ Layout/SpaceBeforeBrackets:
Lint/AmbiguousBlockAssociation: Lint/AmbiguousBlockAssociation:
Enabled: false Enabled: false
# TODO: This group of cops comes from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Lint/ConstantResolution:
Enabled: false
Lint/NumberConversion:
Enabled: false
Lint/DuplicateBranch: Lint/DuplicateBranch:
Exclude: Exclude:
- "Taps/*/*/*.rb" - "Taps/*/*/*.rb"
@ -203,6 +244,14 @@ Performance/Caller:
Performance/MethodObjectAsBlock: Performance/MethodObjectAsBlock:
Enabled: false Enabled: false
# TODO: This group of cops comes from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Performance/ChainArrayAllocation:
Enabled: false
Performance/IoReadlines:
Enabled: false
Performance/OpenStruct:
Enabled: false
Rails: Rails:
# Selectively enable what we want. # Selectively enable what we want.
Enabled: false Enabled: false
@ -258,6 +307,16 @@ RSpec/StubbedMock:
RSpec/SubjectStub: RSpec/SubjectStub:
Enabled: false Enabled: false
# TODO: These cops come from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
RSpec/AlignLeftLetBrace:
Enabled: false
RSpec/AlignRightLetBrace:
Enabled: false
RSpec/MessageExpectation:
Enabled: false
RSpec/Pending:
Enabled: false
# We use `allow(:foo).to receive(:bar)` everywhere. # We use `allow(:foo).to receive(:bar)` everywhere.
RSpec/MessageSpies: RSpec/MessageSpies:
EnforcedStyle: receive EnforcedStyle: receive
@ -284,6 +343,20 @@ Sorbet/ConstantsFromStrings:
Sorbet/FalseSigil: Sorbet/FalseSigil:
Enabled: false Enabled: false
# TODO: These cops come from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Sorbet/EnforceSignatures:
Enabled: false
Sorbet/ForbidTUnsafe:
Enabled: false
Sorbet/ForbidTUntyped:
Enabled: false
Sorbet/HasSigil:
Enabled: false
Sorbet/IgnoreSigil:
Enabled: false
Sorbet/StrongSigil:
Enabled: false
# T::Sig is monkey-patched into Module # T::Sig is monkey-patched into Module
Sorbet/RedundantExtendTSig: Sorbet/RedundantExtendTSig:
Enabled: true Enabled: true
@ -324,6 +397,54 @@ Style/BlockDelimiters:
Style/CollectionMethods: Style/CollectionMethods:
Enabled: true Enabled: true
# TODO: This group of cops comes from `EnabledByDefault: true`. We should maybe enable the ones with < 100 offenses.
Style/ArrayCoercion:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/ClassMethodsDefinitions:
Enabled: false
Style/ConstantVisibility:
Enabled: false
Style/Copyright:
Enabled: false
Style/DateTime:
Enabled: false
Style/DocumentationMethod:
Enabled: false
Style/ImplicitRuntimeError:
Enabled: false
Style/InlineComment:
Enabled: false
Style/IpAddresses:
Enabled: false
Style/MethodCallWithArgsParentheses:
Enabled: false
Style/MethodCalledOnDoEndBlock:
Enabled: false
Style/MissingElse:
Enabled: false
Style/MultilineMethodSignature:
Enabled: false
Style/OptionHash:
Enabled: false
Style/RequireOrder:
Enabled: false
Style/Send:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Style/StaticClass:
Enabled: false
Style/StringHashKeys:
Enabled: false
Style/TopLevelMethodDefinition:
Enabled: false
Style/TrailingCommaInBlockArgs:
Enabled: false
Style/YodaExpression:
Enabled: false
# Don't allow cops to be disabled in casks and formulae. # Don't allow cops to be disabled in casks and formulae.
Style/DisableCopsWithinSourceCodeDirective: Style/DisableCopsWithinSourceCodeDirective:
Enabled: true Enabled: true
@ -374,7 +495,6 @@ Style/HashAsLastArrayItem:
- "**/Formula/**/*.rb" - "**/Formula/**/*.rb"
Style/InvertibleUnlessCondition: Style/InvertibleUnlessCondition:
Enabled: true
InverseMethods: InverseMethods:
# Favor `if a != b` over `unless a == b` # Favor `if a != b` over `unless a == b`
:==: :!= :==: :!=