Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin RuboCop to avoid failures due to renamed cops #2216

Merged
merged 4 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 298 additions & 34 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,336 @@
inherit_from: .rubocop_rspec_base.yml
inherit_from:
- .rubocop_todo.yml

# Over time we'd like to get this down, but this is what we're at now.
LineLength:
Max: 186
AllCops:
Exclude:
# Templates are really ERB which Rubocop does not parse
- 'lib/generators/rspec/*/templates/**/*'

Layout/AccessModifierIndentation:
Enabled: false

Layout/AssignmentIndentation:
Enabled: false

Layout/ClosingParenthesisIndentation:
Enabled: false

Layout/EmptyLineAfterMagicComment:
Enabled: false

# Over time we'd like to get this down, but this is what we're at now.
MethodLength:
Max: 50
Layout/EmptyLineBetweenDefs:
Enabled: false

Layout/EmptyLinesAroundAccessModifier:
Enabled: false

Layout/EmptyLinesAroundBlockBody:
Enabled: false

Layout/ExtraSpacing:
Enabled: false

Layout/FirstArgumentIndentation:
Enabled: false

Layout/FirstArrayElementIndentation:
Enabled: false

Layout/HashAlignment:
Enabled: false

Layout/HeredocIndentation:
Enabled: false

Layout/MultilineMethodCallBraceLayout:
Enabled: false

Layout/MultilineMethodCallIndentation:
Enabled: false

Layout/MultilineOperationIndentation:
Enabled: false

Layout/ParameterAlignment:
EnforcedStyle: with_first_parameter

Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false

# We use spaces, so it's less of a change to stick with that.
SpaceAroundEqualsInParameterDefault:
Layout/SpaceAroundEqualsInParameterDefault:
pirj marked this conversation as resolved.
Show resolved Hide resolved
EnforcedStyle: space

################################################################################
# Individual File Exclusions
################################################################################
Layout/SpaceAroundBlockParameters:
Enabled: false

AllCops:
Exclude:
# Templates are really ERB which Rubocop does not parse
- 'lib/generators/rspec/*/templates/**/*'
Layout/SpaceAroundOperators:
Enabled: false

FileName:
Exclude:
# We break convention here so that when bundler requires the gem, which
# uses the gem name, things work without user configuration.
- lib/rspec-rails.rb
Layout/SpaceBeforeComma:
Enabled: false

HandleExceptions:
Layout/SpaceInsideStringInterpolation:
Enabled: false

Lint/AssignmentInCondition:
Enabled: false

Lint/EmptyExpression:
Enabled: false

Lint/ImplicitStringConcatenation:
Enabled: false

Lint/NestedMethodDefinition:
Enabled: false

# Exceptions should be rescued with `Support::AllExceptionsExceptOnesWeMustNotRescue`
Lint/RescueException:
Enabled: true

Lint/SuppressedException:
Exclude:
# RSpec is tightly coupled to capybara right now, this should be
# re-evaluted in the future. For now we allow the empty rescue
- lib/rspec/rails/vendor/capybara.rb

IfUnlessModifier:
Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Enabled: false

# Warns when the class is excessively long.
Metrics/ClassLength:
Max: 100

Metrics/PerceivedComplexity:
Enabled: false

# Who cares what we call the argument for binary operator methods?
Naming/BinaryOperatorParameterName:
Enabled: false

Naming/ConstantName:
Enabled: false

Naming/FileName:
Exclude:
# Allow single line statement as the style matches the remainder of the file
- lib/rspec/rails/vendor/capybara.rb
# We break convention here so that when bundler requires the gem, which
# uses the gem name, things work without user configuration.
- lib/rspec-rails.rb

Naming/HeredocDelimiterNaming:
Enabled: false

Naming/MemoizedInstanceVariableName:
Enabled: false

PerlBackrefs:
Naming/MethodParameterName:
Enabled: false

# We have too many special cases where we allow generator methods or prefer a
# prefixed predicate due to it's improved readability.
Naming/PredicateName:
Enabled: false

Naming/RescuedExceptionsVariableName:
Enabled: false

Naming/VariableNumber:
Enabled: false

Style/CollectionMethods:
PreferredMethods:
reduce: 'inject'

Style/AccessModifierDeclarations:
Enabled: false

# "Use alias_method instead of alias"
# We're fine with `alias`.
Style/Alias:
Enabled: false

Style/BlockDelimiters:
Enabled: false

# "Avoid the use of the case equality operator ==="
# We prefer using `Class#===` over `Object#is_a?` because `Class#===`
# is less likely to be monkey patched than `is_a?` on a user object.
Style/CaseEquality:
Enabled: false

Style/ClassCheck:
Enabled: false

Style/ConditionalAssignment:
Enabled: false

Style/DateTime:
Enabled: false

# We use YARD to enforce documentation. It works better than rubocop's
# enforcement...rubocop complains about the places we re-open
# `RSpec::Expectations` and `RSpec::Matchers` w/o having doc commments.
Style/Documentation:
Enabled: false

Style/DoubleNegation:
Enabled: false

Style/EmptyMethod:
Enabled: false

Style/EmptyCaseCondition:
Enabled: false

Style/EmptyElse:
Enabled: false

Style/FormatString:
EnforcedStyle: percent

Style/FormatStringToken:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/GuardClause:
Enabled: false

Style/IdenticalConditionalBranches:
Enabled: false

Style/IfUnlessModifierOfIfUnless:
Enabled: false

Style/IfInsideElse:
Enabled: false

Style/IfUnlessModifier:
pirj marked this conversation as resolved.
Show resolved Hide resolved
Enabled: false

Style/MethodMissingSuper:
Enabled: false

Style/MissingRespondToMissing:
Enabled: false

Style/MixinUsage:
Enabled: false

Style/MultilineIfModifier:
Enabled: false

Style/MultipleComparison:
Enabled: false

Style/MutableConstant:
Enabled: false

Style/NestedModifier:
Enabled: false

Style/NestedParenthesizedCalls:
Enabled: false

Style/NumericPredicate:
Enabled: false

Style/ParallelAssignment:
Enabled: false

Style/ParenthesesAroundCondition:
Enabled: false

Style/PerlBackrefs:
Exclude:
# We probably can refactor the backref out, but for now excluding it since
# we can't use named matches in 1.8.7
- lib/generators/rspec/scaffold/scaffold_generator.rb

Style/AccessModifierDeclarations:
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': () # double-quoted string
'%i': '[]' # array of symbols
'%q': () # single-quoted string
'%Q': () # double-quoted string
'%r': '{}' # regular expression pattern
'%s': () # a symbol
'%w': '[]' # array of single-quoted strings
'%W': '[]' # array of double-quoted strings
'%x': () # a shell command as a string

# On 1.8 `proc` was `lambda`, so we used `Proc.new` to ensure we got real procs
# on all supported versions.
# http://batsov.com/articles/2014/02/04/the-elements-of-style-in-ruby-number-12-proc-vs-proc-dot-new/
Style/Proc:
Enabled: false

Naming/MemoizedInstanceVariableName:
Style/RegexpLiteral:
Enabled: false

Naming/UncommunicativeMethodParamName:
Style/RedundantReturn:
Enabled: false

Metrics/PerceivedComplexity:
Style/RedundantParentheses:
Enabled: false

Metrics/BlockLength:
Style/RescueStandardError:
Enabled: false

Lint/AssignmentInCondition:
# We haven't adopted the `fail` to signal exceptions vs `raise` for re-raises convention.
Style/SignalException:
Enabled: false

Lint/EmptyExpression:
# This rule favors constant names from the English standard library which we don't load.
Style/SpecialGlobalVars:
Enabled: false

Layout/AlignHash:
Style/StderrPuts:
Enabled: false

Naming/RescuedExceptionsVariableName:
Style/StringLiteralsInInterpolation:
Enabled: false

Style/StructInheritance:
Enabled: false

# We don't care about single vs double qoutes.
Style/StringLiterals:
Enabled: false

Style/SymbolArray:
Enabled: false

Style/SymbolProc:
Enabled: false

Style/TernaryParentheses:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Style/TrailingCommaInHashLiteral:
Enabled: false

Style/TrailingCommaInArguments:
Enabled: false

Style/TrivialAccessors:
AllowDSLWriters: true
AllowPredicates: true
ExactNameMatch: true

Style/TrailingUnderscoreVariable:
Enabled: false

Style/YodaCondition:
Enabled: false

Style/ZeroLengthPredicate:
Enabled: false
Loading