From e18a8d1fa23f1a98d29304b73d97d9bca27746a9 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 2 Dec 2019 18:19:15 +0300 Subject: [PATCH 1/4] Pin RuboCop to avoid failures due to renamed cops In RuboCop 1.0 this will stop happening, and we'll be able to relax it to: gem 'rubocop', '~> 1.0' --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ebe887d2bf..5009efaa2c 100644 --- a/Gemfile +++ b/Gemfile @@ -67,7 +67,7 @@ end gem "rubyzip", '~> 1.2' -gem 'rubocop', "~> 0.74" +gem 'rubocop', '~> 0.74.0' custom_gemfile = File.expand_path("../Gemfile-custom", __FILE__) eval_gemfile custom_gemfile if File.exist?(custom_gemfile) From b0a4291b430109158ae8da1c0662dde3735ff8dd Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 4 Dec 2019 21:48:54 +0300 Subject: [PATCH 2/4] Normalize RuboCop configuration --- .rubocop.yml | 26 ++--- .rubocop_rspec_base.yml | 233 +++++++++++++++++----------------------- .rubocop_todo.yml | 27 +++++ Gemfile | 2 +- 4 files changed, 136 insertions(+), 152 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index e122960322..891fafc2ff 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,15 +1,9 @@ -inherit_from: .rubocop_rspec_base.yml - -# Over time we'd like to get this down, but this is what we're at now. -LineLength: - Max: 186 - -# Over time we'd like to get this down, but this is what we're at now. -MethodLength: - Max: 50 +inherit_from: + - .rubocop_todo.yml + - .rubocop_rspec_base.yml # We use spaces, so it's less of a change to stick with that. -SpaceAroundEqualsInParameterDefault: +Layout/SpaceAroundEqualsInParameterDefault: EnforcedStyle: space ################################################################################ @@ -21,24 +15,24 @@ AllCops: # Templates are really ERB which Rubocop does not parse - 'lib/generators/rspec/*/templates/**/*' -FileName: +Naming/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 -HandleExceptions: +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: +Style/IfUnlessModifier: Exclude: # Allow single line statement as the style matches the remainder of the file - lib/rspec/rails/vendor/capybara.rb -PerlBackrefs: +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 @@ -50,7 +44,7 @@ Style/AccessModifierDeclarations: Naming/MemoizedInstanceVariableName: Enabled: false -Naming/UncommunicativeMethodParamName: +Naming/MethodParameterName: Enabled: false Metrics/PerceivedComplexity: @@ -65,7 +59,7 @@ Lint/AssignmentInCondition: Lint/EmptyExpression: Enabled: false -Layout/AlignHash: +Layout/HashAlignment: Enabled: false Naming/RescuedExceptionsVariableName: diff --git a/.rubocop_rspec_base.yml b/.rubocop_rspec_base.yml index 045f1799cd..6e8d6fd9af 100644 --- a/.rubocop_rspec_base.yml +++ b/.rubocop_rspec_base.yml @@ -4,76 +4,34 @@ # This file contains defaults for RSpec projects. Individual projects # can customize by inheriting this file and overriding particular settings. -AccessModifierIndentation: - Enabled: false - -# "Use alias_method instead of alias" -# We're fine with `alias`. -Alias: - Enabled: false - -AlignParameters: - EnforcedStyle: with_first_parameter - -# "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. -CaseEquality: - Enabled: false - # Warns when the class is excessively long. Metrics/ClassLength: Max: 100 -CollectionMethods: +Metrics/AbcSize: + Enabled: false + +Style/CollectionMethods: PreferredMethods: reduce: 'inject' -# Over time we'd like to get this down, but this is what we're at now. -CyclomaticComplexity: - Max: 10 - # 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. -Documentation: +Style/Documentation: Enabled: false -# We still support 1.8.7 which requires trailing dots -DotPosition: - EnforcedStyle: trailing - -DoubleNegation: - Enabled: false - -# each_with_object is unavailable on 1.8.7 so we have to disable this one. -EachWithObject: +Style/DoubleNegation: Enabled: false -FormatString: +Style/FormatString: EnforcedStyle: percent -# As long as we support ruby 1.8.7 we have to use hash rockets. -HashSyntax: - EnforcedStyle: hash_rockets - -# We can't use the new lambda syntax, since we still support 1.8.7. -Lambda: - Enabled: false - -# Over time we'd like to get this down, but this is what we're at now. -LineLength: - Max: 100 - -# Over time we'd like to get this down, but this is what we're at now. -Metrics/MethodLength: - Max: 15 - # Who cares what we call the argument for binary operator methods? -BinaryOperatorParameterName: +Naming/BinaryOperatorParameterName: Enabled: false -PercentLiteralDelimiters: +Style/PercentLiteralDelimiters: PreferredDelimiters: '%': () # double-quoted string '%i': '[]' # array of symbols @@ -87,230 +45,235 @@ PercentLiteralDelimiters: # We have too many special cases where we allow generator methods or prefer a # prefixed predicate due to it's improved readability. -PredicateName: - Enabled: false - -# On 1.8 `proc` is `lambda`, so we use `Proc.new` to ensure we get 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/ -Proc: +Naming/PredicateName: Enabled: false # Exceptions should be rescued with `Support::AllExceptionsExceptOnesWeMustNotRescue` -RescueException: +Lint/RescueException: Enabled: true # We haven't adopted the `fail` to signal exceptions vs `raise` for re-raises convention. -SignalException: +Style/SignalException: Enabled: false -# We've tended to use no space, so it's less of a change to stick with that. -SpaceAroundEqualsInParameterDefault: - EnforcedStyle: no_space - # We don't care about single vs double qoutes. -StringLiterals: +Style/StringLiterals: Enabled: false -# This rule favors constant names from the English standard library which we don't load. -Style/SpecialGlobalVars: +Layout/EmptyLineAfterMagicComment: Enabled: false -Style/TrailingCommaInArrayLiteral: +Layout/FirstArrayElementIndentation: Enabled: false -Style/TrailingCommaInHashLiteral: +Layout/AssignmentIndentation: Enabled: false -Style/TrailingCommaInArguments: +Layout/HeredocIndentation: Enabled: false -TrivialAccessors: - AllowDSLWriters: true - AllowPredicates: true - ExactNameMatch: true - -Style/ParallelAssignment: +Layout/SpaceInsidePercentLiteralDelimiters: Enabled: false Layout/EmptyLineBetweenDefs: Enabled: false -Layout/IndentFirstArgument: +Layout/FirstArgumentIndentation: Enabled: false -Naming/ConstantName: +Layout/ParameterAlignment: + EnforcedStyle: with_first_parameter + +Layout/ClosingParenthesisIndentation: Enabled: false -Style/ClassCheck: +Layout/ExtraSpacing: Enabled: false -Style/ConditionalAssignment: +Layout/MultilineMethodCallBraceLayout: Enabled: false -Style/EmptyMethod: +Layout/MultilineMethodCallIndentation: Enabled: false -Style/FormatStringToken: +Layout/MultilineOperationIndentation: Enabled: false -Style/FrozenStringLiteralComment: +Layout/SpaceAroundBlockParameters: Enabled: false -Style/GuardClause: +Layout/SpaceAroundOperators: Enabled: false -Style/IdenticalConditionalBranches: +Layout/SpaceBeforeComma: Enabled: false -Style/IfUnlessModifier: +Layout/SpaceInsideStringInterpolation: Enabled: false -Style/IfUnlessModifierOfIfUnless: +Layout/EmptyLinesAroundBlockBody: Enabled: false -Style/MethodMissingSuper: +Layout/EmptyLinesAroundAccessModifier: Enabled: false -Style/MissingRespondToMissing: +Lint/ImplicitStringConcatenation: Enabled: false -Style/MixinUsage: +Lint/NestedMethodDefinition: Enabled: false -Style/MultipleComparison: +Naming/HeredocDelimiterNaming: Enabled: false -Style/MutableConstant: +Naming/ConstantName: Enabled: false -Style/NestedModifier: +Naming/VariableNumber: Enabled: false -Style/NestedParenthesizedCalls: +Layout/AccessModifierIndentation: Enabled: false -Style/NumericPredicate: +# "Use alias_method instead of alias" +# We're fine with `alias`. +Style/Alias: Enabled: false -Style/RedundantParentheses: +# "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/StringLiteralsInInterpolation: +# This rule favors constant names from the English standard library which we don't load. +Style/SpecialGlobalVars: Enabled: false -Style/SymbolArray: +Style/TrailingCommaInArrayLiteral: Enabled: false -Style/SymbolProc: +Style/TrailingCommaInHashLiteral: Enabled: false -Style/YodaCondition: +Style/TrailingCommaInArguments: Enabled: false -Style/ZeroLengthPredicate: +Style/TrivialAccessors: + AllowDSLWriters: true + AllowPredicates: true + ExactNameMatch: true + +Style/ParallelAssignment: Enabled: false -Layout/ClosingParenthesisIndentation: +Style/ClassCheck: Enabled: false -Layout/ExtraSpacing: +Style/ConditionalAssignment: Enabled: false -Layout/MultilineMethodCallBraceLayout: +Style/EmptyMethod: Enabled: false -Layout/MultilineMethodCallIndentation: +Style/FormatStringToken: Enabled: false -Layout/MultilineOperationIndentation: +Style/FrozenStringLiteralComment: Enabled: false -Layout/SpaceAroundBlockParameters: +Style/GuardClause: Enabled: false -Layout/SpaceAroundOperators: +Style/IdenticalConditionalBranches: Enabled: false -Layout/SpaceBeforeComma: +Style/IfUnlessModifier: Enabled: false -Style/BlockDelimiters: +Style/IfUnlessModifierOfIfUnless: Enabled: false -Style/EmptyCaseCondition: +Style/MethodMissingSuper: Enabled: false -Style/MultilineIfModifier: +Style/MissingRespondToMissing: Enabled: false -Style/RescueStandardError: +Style/MixinUsage: Enabled: false -Style/StderrPuts: +Style/MultipleComparison: Enabled: false -Style/TernaryParentheses: +Style/MutableConstant: Enabled: false -Naming/HeredocDelimiterNaming: +Style/NestedModifier: Enabled: false -Layout/EmptyLineAfterMagicComment: +Style/NestedParenthesizedCalls: Enabled: false -Layout/IndentFirstArrayElement: +Style/NumericPredicate: Enabled: false -Layout/IndentAssignment: +Style/RedundantParentheses: Enabled: false -Layout/IndentHeredoc: +Style/StringLiteralsInInterpolation: Enabled: false -Layout/SpaceInsidePercentLiteralDelimiters: +Style/SymbolArray: Enabled: false -Style/EmptyElse: +Style/SymbolProc: Enabled: false -Style/IfInsideElse: +Style/YodaCondition: Enabled: false -Style/RedundantReturn: +Style/ZeroLengthPredicate: Enabled: false -Style/StructInheritance: +Style/BlockDelimiters: Enabled: false -Naming/VariableNumber: +Style/EmptyCaseCondition: Enabled: false -Layout/SpaceInsideStringInterpolation: +Style/MultilineIfModifier: Enabled: false -Style/DateTime: +Style/RescueStandardError: Enabled: false -Style/ParenthesesAroundCondition: +Style/StderrPuts: Enabled: false -Layout/EmptyLinesAroundBlockBody: +Style/TernaryParentheses: Enabled: false -Lint/ImplicitStringConcatenation: +Style/EmptyElse: Enabled: false -Lint/NestedMethodDefinition: +Style/IfInsideElse: Enabled: false -Style/RegexpLiteral: +Style/RedundantReturn: Enabled: false -Style/TrailingUnderscoreVariable: +Style/StructInheritance: Enabled: false -Layout/EmptyLinesAroundAccessModifier: +Style/DateTime: Enabled: false -Metrics/AbcSize: +Style/ParenthesesAroundCondition: + Enabled: false + +Style/RegexpLiteral: + Enabled: false + +Style/TrailingUnderscoreVariable: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000000..ee1f27f00a --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,27 @@ +# ruby 1.8.7 required trailing dots +Layout/DotPosition: + EnforcedStyle: trailing + +# Over time we'd like to get this down, but this is what we're at now. +Metrics/CyclomaticComplexity: + Max: 10 + +# Over time we'd like to get this down, but this is what we're at now. +Metrics/LineLength: + Max: 186 + +# Over time we'd like to get this down, but this is what we're at now. +Metrics/MethodLength: + Max: 50 + +# each_with_object was unavailable on ruby 1.8.7 +Style/EachWithObject: + Enabled: false + +# ruby 1.8.7 only had support for hash rockets +Style/HashSyntax: + EnforcedStyle: hash_rockets + +# the new lambda syntax was not supported in ruby 1.8.7 +Style/Lambda: + Enabled: false diff --git a/Gemfile b/Gemfile index 5009efaa2c..ec02a32457 100644 --- a/Gemfile +++ b/Gemfile @@ -67,7 +67,7 @@ end gem "rubyzip", '~> 1.2' -gem 'rubocop', '~> 0.74.0' +gem 'rubocop', '~> 0.77.0' custom_gemfile = File.expand_path("../Gemfile-custom", __FILE__) eval_gemfile custom_gemfile if File.exist?(custom_gemfile) From e0492a03b82c34d70128725ab0a2262eaf6e65ba Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 4 Dec 2019 22:18:52 +0300 Subject: [PATCH 3/4] Merge in base RuboCop config --- .rubocop.yml | 315 +++++++++++++++++++++++++++++++++++++--- .rubocop_rspec_base.yml | 279 ----------------------------------- .rubocop_todo.yml | 8 +- 3 files changed, 295 insertions(+), 307 deletions(-) delete mode 100644 .rubocop_rspec_base.yml diff --git a/.rubocop.yml b/.rubocop.yml index 891fafc2ff..e00c2bd3e8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,19 +1,119 @@ inherit_from: - .rubocop_todo.yml - - .rubocop_rspec_base.yml + +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 + +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. Layout/SpaceAroundEqualsInParameterDefault: EnforcedStyle: space -################################################################################ -# Individual File Exclusions -################################################################################ +Layout/SpaceAroundBlockParameters: + Enabled: false + +Layout/SpaceAroundOperators: + Enabled: false -AllCops: +Layout/SpaceBeforeComma: + Enabled: false + +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: - # Templates are really ERB which Rubocop does not parse - - 'lib/generators/rspec/*/templates/**/*' + # 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 + +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: @@ -21,16 +121,130 @@ Naming/FileName: # uses the gem name, things work without user configuration. - lib/rspec-rails.rb -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 +Naming/HeredocDelimiterNaming: + Enabled: false + +Naming/MemoizedInstanceVariableName: + Enabled: false + +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: - Exclude: - # Allow single line statement as the style matches the remainder of the file - - lib/rspec/rails/vendor/capybara.rb + 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: @@ -38,29 +252,82 @@ Style/PerlBackrefs: # 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 + +Style/Proc: Enabled: false -Naming/MemoizedInstanceVariableName: +Style/RegexpLiteral: Enabled: false -Naming/MethodParameterName: +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/HashAlignment: +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 diff --git a/.rubocop_rspec_base.yml b/.rubocop_rspec_base.yml deleted file mode 100644 index 6e8d6fd9af..0000000000 --- a/.rubocop_rspec_base.yml +++ /dev/null @@ -1,279 +0,0 @@ -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. -# DO NOT modify it by hand as your changes will get lost the next time it is generated. - -# This file contains defaults for RSpec projects. Individual projects -# can customize by inheriting this file and overriding particular settings. - -# Warns when the class is excessively long. -Metrics/ClassLength: - Max: 100 - -Metrics/AbcSize: - Enabled: false - -Style/CollectionMethods: - PreferredMethods: - reduce: 'inject' - -# 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/FormatString: - EnforcedStyle: percent - -# Who cares what we call the argument for binary operator methods? -Naming/BinaryOperatorParameterName: - Enabled: false - -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 - -# 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 - -# Exceptions should be rescued with `Support::AllExceptionsExceptOnesWeMustNotRescue` -Lint/RescueException: - Enabled: true - -# We haven't adopted the `fail` to signal exceptions vs `raise` for re-raises convention. -Style/SignalException: - Enabled: false - -# We don't care about single vs double qoutes. -Style/StringLiterals: - Enabled: false - -Layout/EmptyLineAfterMagicComment: - Enabled: false - -Layout/FirstArrayElementIndentation: - Enabled: false - -Layout/AssignmentIndentation: - Enabled: false - -Layout/HeredocIndentation: - Enabled: false - -Layout/SpaceInsidePercentLiteralDelimiters: - Enabled: false - -Layout/EmptyLineBetweenDefs: - Enabled: false - -Layout/FirstArgumentIndentation: - Enabled: false - -Layout/ParameterAlignment: - EnforcedStyle: with_first_parameter - -Layout/ClosingParenthesisIndentation: - Enabled: false - -Layout/ExtraSpacing: - Enabled: false - -Layout/MultilineMethodCallBraceLayout: - Enabled: false - -Layout/MultilineMethodCallIndentation: - Enabled: false - -Layout/MultilineOperationIndentation: - Enabled: false - -Layout/SpaceAroundBlockParameters: - Enabled: false - -Layout/SpaceAroundOperators: - Enabled: false - -Layout/SpaceBeforeComma: - Enabled: false - -Layout/SpaceInsideStringInterpolation: - Enabled: false - -Layout/EmptyLinesAroundBlockBody: - Enabled: false - -Layout/EmptyLinesAroundAccessModifier: - Enabled: false - -Lint/ImplicitStringConcatenation: - Enabled: false - -Lint/NestedMethodDefinition: - Enabled: false - -Naming/HeredocDelimiterNaming: - Enabled: false - -Naming/ConstantName: - Enabled: false - -Naming/VariableNumber: - Enabled: false - -Layout/AccessModifierIndentation: - Enabled: false - -# "Use alias_method instead of alias" -# We're fine with `alias`. -Style/Alias: - 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 - -# This rule favors constant names from the English standard library which we don't load. -Style/SpecialGlobalVars: - Enabled: false - -Style/TrailingCommaInArrayLiteral: - Enabled: false - -Style/TrailingCommaInHashLiteral: - Enabled: false - -Style/TrailingCommaInArguments: - Enabled: false - -Style/TrivialAccessors: - AllowDSLWriters: true - AllowPredicates: true - ExactNameMatch: true - -Style/ParallelAssignment: - Enabled: false - -Style/ClassCheck: - Enabled: false - -Style/ConditionalAssignment: - Enabled: false - -Style/EmptyMethod: - Enabled: false - -Style/FormatStringToken: - Enabled: false - -Style/FrozenStringLiteralComment: - Enabled: false - -Style/GuardClause: - Enabled: false - -Style/IdenticalConditionalBranches: - Enabled: false - -Style/IfUnlessModifier: - Enabled: false - -Style/IfUnlessModifierOfIfUnless: - Enabled: false - -Style/MethodMissingSuper: - Enabled: false - -Style/MissingRespondToMissing: - Enabled: false - -Style/MixinUsage: - Enabled: false - -Style/MultipleComparison: - Enabled: false - -Style/MutableConstant: - Enabled: false - -Style/NestedModifier: - Enabled: false - -Style/NestedParenthesizedCalls: - Enabled: false - -Style/NumericPredicate: - Enabled: false - -Style/RedundantParentheses: - Enabled: false - -Style/StringLiteralsInInterpolation: - Enabled: false - -Style/SymbolArray: - Enabled: false - -Style/SymbolProc: - Enabled: false - -Style/YodaCondition: - Enabled: false - -Style/ZeroLengthPredicate: - Enabled: false - -Style/BlockDelimiters: - Enabled: false - -Style/EmptyCaseCondition: - Enabled: false - -Style/MultilineIfModifier: - Enabled: false - -Style/RescueStandardError: - Enabled: false - -Style/StderrPuts: - Enabled: false - -Style/TernaryParentheses: - Enabled: false - -Style/EmptyElse: - Enabled: false - -Style/IfInsideElse: - Enabled: false - -Style/RedundantReturn: - Enabled: false - -Style/StructInheritance: - Enabled: false - -Style/DateTime: - Enabled: false - -Style/ParenthesesAroundCondition: - Enabled: false - -Style/RegexpLiteral: - Enabled: false - -Style/TrailingUnderscoreVariable: - Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ee1f27f00a..d4dffc2e57 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -4,15 +4,15 @@ Layout/DotPosition: # Over time we'd like to get this down, but this is what we're at now. Metrics/CyclomaticComplexity: - Max: 10 + Max: 9 # default: 6 # Over time we'd like to get this down, but this is what we're at now. Metrics/LineLength: - Max: 186 + Max: 186 # default: 80 # Over time we'd like to get this down, but this is what we're at now. Metrics/MethodLength: - Max: 50 + Max: 43 # default: 10 # each_with_object was unavailable on ruby 1.8.7 Style/EachWithObject: @@ -20,7 +20,7 @@ Style/EachWithObject: # ruby 1.8.7 only had support for hash rockets Style/HashSyntax: - EnforcedStyle: hash_rockets + EnforcedStyle: hash_rockets # default: ruby19 # the new lambda syntax was not supported in ruby 1.8.7 Style/Lambda: From c5bad1c99107301eca1cde426666dd43966af09f Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 5 Dec 2019 20:20:50 +0000 Subject: [PATCH 4/4] Add comment about rule [skip ci] --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index e00c2bd3e8..a65610a4e5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -264,6 +264,9 @@ Style/PercentLiteralDelimiters: '%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