From 4d5c7a724203f336dbfdd601d88b09aa63b96a6d Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Fri, 18 Nov 2022 13:50:43 -0800 Subject: [PATCH 1/2] Merge in changes from latest master in original file also update to work with ruby 3.1.2 --- rubocop-airbnb/CHANGELOG.md | 25 +++++++++ rubocop-airbnb/README.md | 5 ++ rubocop-airbnb/config/default.yml | 25 ++++++--- rubocop-airbnb/config/rubocop-airbnb.yml | 5 -- rubocop-airbnb/config/rubocop-gemspec.yml | 3 ++ rubocop-airbnb/config/rubocop-layout.yml | 34 ++++++++----- rubocop-airbnb/config/rubocop-lint.yml | 33 ++++++------ rubocop-airbnb/config/rubocop-metrics.yml | 4 -- rubocop-airbnb/config/rubocop-naming.yml | 9 ++-- rubocop-airbnb/config/rubocop-performance.yml | 5 -- rubocop-airbnb/config/rubocop-rails.yml | 16 ++++++ rubocop-airbnb/config/rubocop-rspec.yml | 15 +++--- rubocop-airbnb/config/rubocop-style.yml | 51 +++++++++++-------- rubocop-airbnb/lib/rubocop-airbnb.rb | 5 +- rubocop-airbnb/lib/rubocop/airbnb/version.rb | 2 +- .../rubocop/cop/airbnb/continuation_slash.rb | 4 +- .../cop/airbnb/spec_constant_assignment.rb | 2 +- rubocop-airbnb/rubocop-airbnb.gemspec | 12 ++--- 18 files changed, 155 insertions(+), 100 deletions(-) diff --git a/rubocop-airbnb/CHANGELOG.md b/rubocop-airbnb/CHANGELOG.md index f45b6cc..809115b 100644 --- a/rubocop-airbnb/CHANGELOG.md +++ b/rubocop-airbnb/CHANGELOG.md @@ -1,3 +1,28 @@ +# 4.0.0 +* Add support for Ruby 3.0 +* Run CI against Ruby 2.7 +* Drop support for Ruby 2.3 +* Update rubocop to 0.93.1 +* Update rubocop-performance to 1.10.2 +* Update rubocop-rails to 2.9.1 +* Update rubocop-rspec to 1.44.1 +* Disable Style/BracesAroundHashParameters +* Set `DisabledByDefault: true` to disable any new rubocop cops that have not yet been evaluated for this style guide + +# 3.0.2 +* Moves `require`s for `rubocop-performance` and `rubocop-rails` to library code for better transitivity. + +# 3.0.1 +* Update supported ruby versions in gemspec + +# 3.0.0 +* Update to rubocop 0.76 +* Enable Rails/IgnoredSkipActionFilterOption +* Enable Rails/ReflectionClassName +* Disable and delete Airbnb/ClassName +* Enable Layout/IndentFirstParameter +* Drop support for Ruby 2.2 + # 2.0.0 * Upgrade to rubocop-rspec 1.30.0, use ~> to allow for PATCH version flexibility * Upgrade to rubocop 0.58.0, use ~> to allow for PATCH version flexibility diff --git a/rubocop-airbnb/README.md b/rubocop-airbnb/README.md index d9b3be1..9a3cbe5 100644 --- a/rubocop-airbnb/README.md +++ b/rubocop-airbnb/README.md @@ -15,6 +15,11 @@ Just put this in your `Gemfile` it depends on the appropriate version of rubocop gem 'rubocop-airbnb' ``` +Note: If you want to run with Ruby 2.2 you will need to set your version to 2 +``` +gem 'rubocop-airbnb', '~> 2' +``` + ## Usage You need to tell RuboCop to load the Airbnb extension. There are three diff --git a/rubocop-airbnb/config/default.yml b/rubocop-airbnb/config/default.yml index eaa649d..77254f6 100644 --- a/rubocop-airbnb/config/default.yml +++ b/rubocop-airbnb/config/default.yml @@ -15,14 +15,23 @@ AllCops: - 'vendor/**/*' - Vagrantfile - Guardfile - RSpec: - Patterns: - - _spec.rb - - "(?:^|/)spec/" - RSpec/FactoryBot: - Patterns: - - spec/factories/**/*.rb - - features/support/factories/**/*.rb + # RSpec: + # Patterns: + # - _spec.rb + # - "(?:^|/)spec/" + # RSpec/FactoryBot: + # Patterns: + # - spec/factories/**/*.rb + # - features/support/factories/**/*.rb + + # While Rubocop has released a bunch of new cops, not all of these cops have been evaluated as + # part of this styleguide. To prevent new, unevaluated cops from imposing on this styleguide, we + # are marking these new cops as disabled. Note that as a consumer of this styleguide, you can + # always override any choices here by setting `Enabled: true` on any cops that you would like to + # have be enabled, even if we have explicitly disabled them (or if they are new and we have yet + # to evaluate them). For more on this configuration parameter, see + # https://github.com/rubocop/rubocop/blob/1e55b1aa5e4c5eaeccad5d61f08b7930ed6bc341/config/default.yml#L89-L101 + DisabledByDefault: true inherit_from: - './rubocop-airbnb.yml' diff --git a/rubocop-airbnb/config/rubocop-airbnb.yml b/rubocop-airbnb/config/rubocop-airbnb.yml index 01d342e..dbe7170 100644 --- a/rubocop-airbnb/config/rubocop-airbnb.yml +++ b/rubocop-airbnb/config/rubocop-airbnb.yml @@ -2,11 +2,6 @@ # They are custom built for use inside Airbnb and address issues that we have experienced in # testing and production. -Airbnb/ClassName: - Description: Use :class_name => "Model" instead of :class_name => Model.name - to avoid a long cascade of autoloading. - Enabled: true - Airbnb/ClassOrModuleDeclaredInWrongFile: Description: Declare a class or module in the file that matches its namespace and name. Enabled: true diff --git a/rubocop-airbnb/config/rubocop-gemspec.yml b/rubocop-airbnb/config/rubocop-gemspec.yml index 631a131..17cb6d8 100644 --- a/rubocop-airbnb/config/rubocop-gemspec.yml +++ b/rubocop-airbnb/config/rubocop-gemspec.yml @@ -7,3 +7,6 @@ Gemspec/RequiredRubyVersion: Enabled: false Include: - '**/*.gemspec' + +Gemspec/RubyVersionGlobalsUsage: + Enabled: true diff --git a/rubocop-airbnb/config/rubocop-layout.yml b/rubocop-airbnb/config/rubocop-layout.yml index c1a8478..9cf7789 100644 --- a/rubocop-airbnb/config/rubocop-layout.yml +++ b/rubocop-airbnb/config/rubocop-layout.yml @@ -11,13 +11,13 @@ Layout/AccessModifierIndentation: - indent # Supports --auto-correct -Layout/AlignArray: +Layout/ArrayAlignment: Description: Align the elements of an array literal if they span more than one line. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#align-multiline-arrays Enabled: true # Supports --auto-correct -Layout/AlignHash: +Layout/HashAlignment: Description: Align the elements of a hash literal if they span more than one line. Enabled: true EnforcedHashRocketStyle: key @@ -30,7 +30,7 @@ Layout/AlignHash: - ignore_explicit # Supports --auto-correct -Layout/AlignParameters: +Layout/ParameterAlignment: Description: Align the parameters of a method call if they span more than one line. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-double-indent Enabled: true @@ -227,7 +227,7 @@ Layout/FirstMethodParameterLineBreak: Enabled: false # Supports --auto-correct -Layout/IndentFirstArgument: +Layout/FirstArgumentIndentation: Description: Checks the indentation of the first parameter in a method call. Enabled: true EnforcedStyle: consistent @@ -238,20 +238,19 @@ Layout/IndentFirstArgument: - special_for_inner_method_call_in_parentheses # Supports --auto-correct -Layout/IndentFirstArrayElement: +Layout/FirstArrayElementIndentation: Description: Checks the indentation of the first element in an array literal. Enabled: true EnforcedStyle: consistent # Supports --auto-correct -Layout/IndentAssignment: +Layout/AssignmentIndentation: Description: Checks the indentation of the first line of the right-hand-side of a multi-line assignment. Enabled: true - IndentationWidth: # Supports --auto-correct -Layout/IndentFirstHashElement: +Layout/FirstHashElementIndentation: Description: Checks the indentation of the first key in a hash literal. Enabled: true EnforcedStyle: consistent @@ -259,7 +258,7 @@ Layout/IndentFirstHashElement: - special_inside_parentheses - consistent -Layout/IndentHeredoc: +Layout/HeredocIndentation: Enabled: false # Supports --auto-correct @@ -269,7 +268,7 @@ Layout/IndentationConsistency: EnforcedStyle: normal SupportedStyles: - normal - - rails + - indented_internal_methods # Supports --auto-correct Layout/IndentationWidth: @@ -283,7 +282,7 @@ Layout/InitialIndentation: Description: Checks the indentation of the first non-blank non-comment line in a file. Enabled: true -Layout/LeadingBlankLines: +Layout/LeadingEmptyLines: Enabled: true # Supports --auto-correct @@ -344,7 +343,6 @@ Layout/MultilineMethodCallIndentation: SupportedStyles: - aligned - indented - IndentationWidth: Layout/MultilineMethodDefinitionBraceLayout: Description: >- @@ -533,13 +531,13 @@ Layout/SpaceInsideStringInterpolation: - no_space # Supports --auto-correct -Layout/Tab: +Layout/IndentationStyle: Description: No hard tabs. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-indentation Enabled: true # Supports --auto-correct -Layout/TrailingBlankLines: +Layout/TrailingEmptyLines: Description: Checks trailing blank lines and final newline. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#newline-eof Enabled: true @@ -553,3 +551,11 @@ Layout/TrailingWhitespace: Description: Avoid trailing whitespace. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-whitespace Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +# Supports --auto-correct +Layout/LineLength: + Max: 100 + AllowURI: true diff --git a/rubocop-airbnb/config/rubocop-lint.yml b/rubocop-airbnb/config/rubocop-lint.yml index ed0c245..d23e12a 100644 --- a/rubocop-airbnb/config/rubocop-lint.yml +++ b/rubocop-airbnb/config/rubocop-lint.yml @@ -45,7 +45,7 @@ Lint/DuplicateMethods: Description: Check for duplicate methods calls. Enabled: true -Lint/DuplicatedKey: +Lint/DuplicateHashKey: Description: Check for duplicate keys in hash literals. Enabled: true @@ -68,10 +68,6 @@ Lint/EmptyInterpolation: Lint/EmptyWhen: Enabled: false -Lint/EndInMethod: - Description: END blocks should not be placed inside method definitions. - Enabled: false - Lint/EnsureReturn: Description: Do not use return in an ensure block. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-return-ensure @@ -80,20 +76,20 @@ Lint/EnsureReturn: Lint/ErbNewArguments: Enabled: false -Lint/FloatOutOfRange: - Description: Catches floating-point literals too large or small for Ruby to represent. - Enabled: false - Lint/FlipFlop: Description: Checks for flip flops StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-flip-flops Enabled: false +Lint/FloatOutOfRange: + Description: Catches floating-point literals too large or small for Ruby to represent. + Enabled: false + Lint/FormatParameterMismatch: Description: The number of parameters to format/sprint must match the fields. Enabled: true -Lint/HandleExceptions: +Lint/SuppressedException: Description: Don't suppress exception. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#dont-hide-exceptions Enabled: false @@ -144,7 +140,10 @@ Lint/MissingCopEnableDirective: Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`' Enabled: true -Lint/MultipleCompare: +Lint/MissingSuper: + Enabled: false + +Lint/MultipleComparison: Enabled: false Lint/NestedMethodDefinition: @@ -230,7 +229,7 @@ Lint/ShadowingOuterLocalVariable: Enabled: true # Supports --auto-correct -Lint/StringConversionInInterpolation: +Lint/RedundantStringCoercion: Description: Checks for Object#to_s usage in string interpolation. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-to-s Enabled: true @@ -242,20 +241,20 @@ Lint/UnderscorePrefixedVariableName: Lint/UnifiedInteger: Enabled: false -Lint/UnneededCopDisableDirective: +Lint/RedundantCopDisableDirective: Description: >- Checks for rubocop:disable comments that can be removed. Note: this cop is not disabled when disabling all cops. It must be explicitly disabled. Enabled: true -Lint/UnneededCopEnableDirective: +Lint/RedundantCopEnableDirective: Description: Checks for rubocop:enable comments that can be removed. Enabled: true -Lint/UnneededRequireStatement: +Lint/RedundantRequireStatement: Enabled: false -Lint/UnneededSplatExpansion: +Lint/RedundantSplatExpansion: Enabled: false Lint/UnreachableCode: @@ -289,7 +288,7 @@ Lint/UselessAssignment: StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#underscore-unused-vars Enabled: true -Lint/UselessComparison: +Lint/BinaryOperatorWithIdenticalOperands: Description: Checks for comparison of something with itself. Enabled: true diff --git a/rubocop-airbnb/config/rubocop-metrics.yml b/rubocop-airbnb/config/rubocop-metrics.yml index 5c4ae6a..e99b172 100644 --- a/rubocop-airbnb/config/rubocop-metrics.yml +++ b/rubocop-airbnb/config/rubocop-metrics.yml @@ -21,10 +21,6 @@ Metrics/CyclomaticComplexity: Enabled: false Max: 6 -Metrics/LineLength: - Max: 100 - AllowURI: true - Metrics/MethodLength: Enabled: false diff --git a/rubocop-airbnb/config/rubocop-naming.yml b/rubocop-airbnb/config/rubocop-naming.yml index b447018..5c52447 100644 --- a/rubocop-airbnb/config/rubocop-naming.yml +++ b/rubocop-airbnb/config/rubocop-naming.yml @@ -55,18 +55,18 @@ Naming/PredicateName: - is_ - has_ - have_ - NamePrefixBlacklist: + ForbiddenPrefixes: - is_ - has_ - have_ -Naming/UncommunicativeBlockParamName: +Naming/BlockParameterName: Description: >- Checks for block parameter names that contain capital letters, end in numbers, or do not meet a minimal length. Enabled: false -Naming/UncommunicativeMethodParamName: +Naming/MethodParameterName: Description: >- Checks for method parameter names that contain capital letters, end in numbers, or do not meet a minimal length. @@ -83,3 +83,6 @@ Naming/VariableName: Naming/VariableNumber: Enabled: false + +Naming/RescuedExceptionsVariableName: + Enabled: false diff --git a/rubocop-airbnb/config/rubocop-performance.yml b/rubocop-airbnb/config/rubocop-performance.yml index edc5a2a..067f3ba 100644 --- a/rubocop-airbnb/config/rubocop-performance.yml +++ b/rubocop-airbnb/config/rubocop-performance.yml @@ -56,11 +56,6 @@ Performance/FlatMap: Performance/InefficientHashSearch: Enabled: false -# # Supports --auto-correct -# Performance/LstripRstrip: -# Description: Use `strip` instead of `lstrip.rstrip`. -# Enabled: false - # Supports --auto-correct Performance/RangeInclude: Description: Use `Range#cover?` instead of `Range#include?`. diff --git a/rubocop-airbnb/config/rubocop-rails.yml b/rubocop-airbnb/config/rubocop-rails.yml index cc3b5a3..1daa9eb 100644 --- a/rubocop-airbnb/config/rubocop-rails.yml +++ b/rubocop-airbnb/config/rubocop-rails.yml @@ -68,6 +68,9 @@ Rails/Exit: exits during unit testing or running in production. Enabled: false +Rails/FilePath: + Enabled: false + # Supports --auto-correct Rails/FindBy: Description: Prefer find_by over where.first. @@ -167,6 +170,9 @@ Rails/RequestReferer: Rails/ReversibleMigration: Enabled: false +Rails/SafeNavigation: + Enabled: false + Rails/SaveBang: Enabled: false @@ -200,3 +206,13 @@ Rails/Validation: Enabled: false Include: - app/models/**/*.rb + +Rails/IgnoredSkipActionFilterOption: + Enabled: true + +Rails/ReflectionClassName: + Enabled: true + +Rails/RakeEnvironment: + Description: Ensures that rake tasks depend on :environment + Enabled: false diff --git a/rubocop-airbnb/config/rubocop-rspec.yml b/rubocop-airbnb/config/rubocop-rspec.yml index 4da64d2..7e60cef 100644 --- a/rubocop-airbnb/config/rubocop-rspec.yml +++ b/rubocop-airbnb/config/rubocop-rspec.yml @@ -56,7 +56,6 @@ RSpec/DescribedClass: RSpec/EmptyExampleGroup: Description: Checks if an example group does not include any tests. Enabled: true - CustomIncludeMethods: [] RSpec/EmptyLineAfterExampleGroup: Description: Checks if there is an empty line after example group blocks. @@ -155,9 +154,9 @@ RSpec/InstanceVariable: Description: 'Checks for the usage of instance variables.' Enabled: false -RSpec/InvalidPredicateMatcher: - Description: Checks invalid usage for predicate matcher. - Enabled: false +# RSpec/InvalidPredicateMatcher: +# Description: Checks invalid usage for predicate matcher. +# Enabled: false RSpec/ItBehavesLike: Description: Checks that only one `it_behaves_like` style is used. @@ -314,18 +313,18 @@ RSpec/VoidExpect: Description: This cop checks void `expect()`. Enabled: false -Capybara/CurrentPathExpectation: +RSpec/Capybara/CurrentPathExpectation: Description: Checks that no expectations are set on Capybara's `current_path`. Enabled: false -Capybara/FeatureMethods: +RSpec/Capybara/FeatureMethods: Description: Checks for consistent method usage in feature specs. Enabled: false -FactoryBot/AttributeDefinedStatically: +RSpec/FactoryBot/AttributeDefinedStatically: Description: Always declare attribute values as blocks. Enabled: false -FactoryBot/CreateList: +RSpec/FactoryBot/CreateList: Description: Checks for create_list usage. Enabled: true diff --git a/rubocop-airbnb/config/rubocop-style.yml b/rubocop-airbnb/config/rubocop-style.yml index 06f9dfe..17f9fbf 100644 --- a/rubocop-airbnb/config/rubocop-style.yml +++ b/rubocop-airbnb/config/rubocop-style.yml @@ -116,7 +116,7 @@ Style/BlockDelimiters: - let! - subject - watch - IgnoredMethods: + AllowedMethods: # Methods that can be either procedural or functional and cannot be # categorised from their usage alone, e.g. # @@ -134,16 +134,6 @@ Style/BlockDelimiters: - proc - it -# Supports --auto-correct -Style/BracesAroundHashParameters: - Description: Enforce braces style around hash parameters. - Enabled: false - EnforcedStyle: no_braces - SupportedStyles: - - braces - - no_braces - - context_dependent - Style/CaseEquality: Description: Avoid explicit use of the case equality operator(===). StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-case-equality @@ -355,10 +345,11 @@ Style/FrozenStringLiteralComment: Description: Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0. Enabled: false - EnforcedStyle: always SupportedStyles: - - when_needed - always + - always_true + - never + EnforcedStyle: always_true Style/GlobalVars: Description: Do not introduce global variables. @@ -458,9 +449,6 @@ Style/MethodDefParentheses: - require_parentheses - require_no_parentheses -Style/MethodMissingSuper: - Enabled: false - Style/MissingRespondToMissing: Enabled: false @@ -824,6 +812,21 @@ Style/SpecialGlobalVars: StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-cryptic-perlisms Enabled: true +Style/HashEachMethods: + Description: Enforce use of each_key and each_value Hash methods. + StyleGuide: https://docs.rubocop.org/en/latest/cops_style/#stylehasheachmethods + Enabled: false + +Style/HashTransformKeys: + Description: Enforce use of transform_keys Hash methods. Not suggested for use below ruby 2.5 + StyleGuide: https://docs.rubocop.org/en/latest/cops_style/#stylehashtransformkeys + Enabled: false + +Style/HashTransformValues: + Description: Enforce use of transform_values Hash methods. Not suggested for use below ruby 2.5 + StyleGuide: https://docs.rubocop.org/en/latest/cops_style/#stylehashtransformvalues + Enabled: false + Style/StabbyLambdaParentheses: Description: Check for the usage of parentheses around stabby lambda arguments. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#stabby-lambda-with-args @@ -862,6 +865,11 @@ Style/StringMethods: PreferredMethods: intern: to_sym +# Supports --auto-correct +Style/Strip: + Description: Use `strip` instead of `lstrip.rstrip`. + Enabled: false + Style/StructInheritance: Description: Checks for inheritance from Struct.new. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-extend-struct-new @@ -928,25 +936,25 @@ Style/UnlessElse: Enabled: true # Supports --auto-correct -Style/UnneededCapitalW: +Style/RedundantCapitalW: Description: Checks for %W when interpolation is not needed. Enabled: false -Style/UnneededCondition: +Style/RedundantCondition: Enabled: false # Supports --auto-correct -Style/UnneededInterpolation: +Style/RedundantInterpolation: Description: Checks for strings that are just an interpolated expression. Enabled: false # Supports --auto-correct -Style/UnneededPercentQ: +Style/RedundantPercentQ: Description: Checks for %q/%Q when single quotes or double quotes would do. StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-q Enabled: false -Style/UnneededSort: +Style/RedundantSort: Enabled: false Style/UnpackFirst: @@ -990,4 +998,3 @@ Style/YodaCondition: Style/ZeroLengthPredicate: Description: 'Use #empty? when testing for objects of length 0.' Enabled: false - diff --git a/rubocop-airbnb/lib/rubocop-airbnb.rb b/rubocop-airbnb/lib/rubocop-airbnb.rb index 2e8b9d8..7131cfd 100644 --- a/rubocop-airbnb/lib/rubocop-airbnb.rb +++ b/rubocop-airbnb/lib/rubocop-airbnb.rb @@ -4,11 +4,10 @@ # Load original rubocop gem require 'rubocop' +require 'rubocop-performance' +require 'rubocop-rails' require 'rubocop/airbnb' require 'rubocop/airbnb/inject' require 'rubocop/airbnb/version' -require 'rubocop/airbnb/version' -require 'rubocop-performance' -require 'rubocop-rails' RuboCop::Airbnb::Inject.defaults! diff --git a/rubocop-airbnb/lib/rubocop/airbnb/version.rb b/rubocop-airbnb/lib/rubocop/airbnb/version.rb index aa88c99..7214467 100644 --- a/rubocop-airbnb/lib/rubocop/airbnb/version.rb +++ b/rubocop-airbnb/lib/rubocop/airbnb/version.rb @@ -3,6 +3,6 @@ module RuboCop module Airbnb # Version information for the the Airbnb RuboCop plugin. - VERSION = '2.2.6'.freeze + VERSION = '4.0.0' end end diff --git a/rubocop-airbnb/lib/rubocop/cop/airbnb/continuation_slash.rb b/rubocop-airbnb/lib/rubocop/cop/airbnb/continuation_slash.rb index 5656bdb..2925b59 100644 --- a/rubocop-airbnb/lib/rubocop/cop/airbnb/continuation_slash.rb +++ b/rubocop-airbnb/lib/rubocop/cop/airbnb/continuation_slash.rb @@ -14,9 +14,7 @@ def enforce_violation(node) alias on_send enforce_violation alias on_if enforce_violation - rubocop_version = Gem.loaded_specs.fetch('rubocop', nil)&.version.to_s - assignments = rubocop_version.to_f >= 0.59 ? AST::Node::ASSIGNMENTS : Util::ASGN_NODES - assignments.each do |type| + ::RuboCop::AST::Node::ASSIGNMENTS.each do |type| define_method("on_#{type}") do |node| enforce_violation(node) end diff --git a/rubocop-airbnb/lib/rubocop/cop/airbnb/spec_constant_assignment.rb b/rubocop-airbnb/lib/rubocop/cop/airbnb/spec_constant_assignment.rb index 788c8bf..bac6230 100644 --- a/rubocop-airbnb/lib/rubocop/cop/airbnb/spec_constant_assignment.rb +++ b/rubocop-airbnb/lib/rubocop/cop/airbnb/spec_constant_assignment.rb @@ -26,7 +26,7 @@ module Airbnb # before { stub_const('MyClass::PAYLOAD', [1, 2, 3]) # end class SpecConstantAssignment < Cop - include RuboCop::RSpec::TopLevelDescribe + # include RuboCop::RSpec::TopLevelDescribe MESSAGE = "Defining constants inside of specs can cause spurious behavior. " \ "It is almost always preferable to use `let` statements, "\ "anonymous class/module definitions, or stub_const".freeze diff --git a/rubocop-airbnb/rubocop-airbnb.gemspec b/rubocop-airbnb/rubocop-airbnb.gemspec index 4d70526..6197df6 100644 --- a/rubocop-airbnb/rubocop-airbnb.gemspec +++ b/rubocop-airbnb/rubocop-airbnb.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.license = 'MIT' spec.version = RuboCop::Airbnb::VERSION spec.platform = Gem::Platform::RUBY - spec.required_ruby_version = '>= 2.1' + spec.required_ruby_version = '>= 2.4' spec.require_paths = ['lib'] spec.files = Dir[ @@ -25,9 +25,9 @@ Gem::Specification.new do |spec| 'Gemfile', ] - spec.add_dependency('rubocop', '~> 0.75.1') - spec.add_dependency('rubocop-rspec', '~> 1.36.0') - spec.add_dependency('rubocop-performance', '~> 1.5.0') - spec.add_dependency('rubocop-rails', '~> 2.3.0') - spec.add_development_dependency('rspec', '~> 3.5') + spec.add_dependency('rubocop', '~> 1.39') + spec.add_dependency('rubocop-performance', '~> 1.15.0') + spec.add_dependency('rubocop-rails', '~> 2.17.2') + spec.add_dependency('rubocop-rspec', '~> 2.15.0') + spec.add_development_dependency('rspec', '~> 3.12') end From ed3972318b9c477c9877ed0950218a67347b1f27 Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Fri, 18 Nov 2022 14:06:26 -0800 Subject: [PATCH 2/2] Update rubocop-airbnb.gemspec --- rubocop-airbnb/rubocop-airbnb.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rubocop-airbnb/rubocop-airbnb.gemspec b/rubocop-airbnb/rubocop-airbnb.gemspec index 6197df6..ce951dc 100644 --- a/rubocop-airbnb/rubocop-airbnb.gemspec +++ b/rubocop-airbnb/rubocop-airbnb.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.license = 'MIT' spec.version = RuboCop::Airbnb::VERSION spec.platform = Gem::Platform::RUBY - spec.required_ruby_version = '>= 2.4' + spec.required_ruby_version = '>= 3.1.2' spec.require_paths = ['lib'] spec.files = Dir[