gitlab-styles 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/Gemfile +3 -3
- data/gitlab-styles.gemspec +5 -5
- data/lib/gitlab/styles/version.rb +1 -1
- data/lib/rubocop/cop/active_record_dependent.rb +2 -2
- data/lib/rubocop/cop/active_record_serialize.rb +2 -2
- data/lib/rubocop/cop/avoid_return_from_blocks.rb +3 -1
- data/lib/rubocop/cop/code_reuse/active_record.rb +3 -3
- data/lib/rubocop/cop/custom_error_class.rb +8 -10
- data/lib/rubocop/cop/gem_fetcher.rb +3 -3
- data/lib/rubocop/cop/in_batches.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/deprecate_cop_helper.rb +4 -1
- data/lib/rubocop/cop/line_break_after_guard_clauses.rb +2 -1
- data/lib/rubocop/cop/line_break_around_conditional_block.rb +6 -7
- data/lib/rubocop/cop/migration/update_large_table.rb +5 -4
- data/lib/rubocop/cop/performance/rubyzip.rb +3 -2
- data/lib/rubocop/cop/polymorphic_associations.rb +1 -1
- data/lib/rubocop/cop/rails/include_url_helper.rb +2 -1
- data/lib/rubocop/cop/redirect_with_status.rb +3 -3
- data/lib/rubocop/cop/rspec/base.rb +0 -2
- data/lib/rubocop/cop/rspec/empty_line_after_let_block.rb +7 -7
- data/lib/rubocop/cop/rspec/empty_line_after_shared_example.rb +4 -2
- data/lib/rubocop/cop/rspec/example_starting_character.rb +2 -0
- data/lib/rubocop/cop/rspec/have_link_parameters.rb +2 -1
- data/lib/rubocop/cop/rspec/single_line_hook.rb +3 -1
- data/lib/rubocop/cop/rspec/verbose_include_metadata.rb +2 -0
- data/lib/rubocop/cop/style/hash_transformation.rb +10 -12
- data/lib/rubocop/cop/style/open_struct_use.rb +3 -2
- data/lib/rubocop/cop/without_reactive_cache.rb +2 -2
- data/rubocop-layout.yml +1 -1
- data/rubocop-rspec.yml +13 -5
- metadata +12 -20
- data/lib/gitlab/styles/rubocop/rspec/helpers.rb +0 -18
- data/lib/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb +0 -47
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 410e573c3c17d84349a00ff756141e55ece0ba68c0d9aa23b76cfe2a8abde3ae
         | 
| 4 | 
            +
              data.tar.gz: a2fb908127f5f31c8d4a235155b4b2ad3208802cfc01bf895321a522a270477b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aa3f38ac00b776237c2a497ebb76d36e1ad51addc814ecbba7370a4d4cbeb0f67777131494a825431a2aa592d6597e57eaa83cae86ec452955b0399e1e46e1ec
         | 
| 7 | 
            +
              data.tar.gz: 445dfab1d9c2f0874c1c7ddb65426bf32953515fcfe1e96b15a119914acc5258753182318b524ff2d8af86b0fb1769d09f0991ce1aa8d2d24cd2a22cfcbe62fb
         | 
    
        data/.rubocop.yml
    CHANGED
    
    | @@ -4,7 +4,18 @@ inherit_from: | |
| 4 4 | 
             
            require:
         | 
| 5 5 | 
             
              - rubocop/cop/internal_affairs
         | 
| 6 6 |  | 
| 7 | 
            +
            AllCops:
         | 
| 8 | 
            +
              NewCops: disable # https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/40
         | 
| 9 | 
            +
              SuggestExtensions: false # https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/39
         | 
| 10 | 
            +
             | 
| 7 11 | 
             
            InternalAffairs/DeprecateCopHelper:
         | 
| 8 12 | 
             
              Enabled: true
         | 
| 9 13 | 
             
              Include:
         | 
| 10 14 | 
             
                - spec/**/*.rb
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            # This only makes sense for cops that are included with RuboCop. We could add
         | 
| 17 | 
            +
            # our own config/default.yml and do something like
         | 
| 18 | 
            +
            # https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb,
         | 
| 19 | 
            +
            # but realistically this is OK here.
         | 
| 20 | 
            +
            InternalAffairs/UndefinedConfig:
         | 
| 21 | 
            +
              Enabled: false
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -7,7 +7,7 @@ gemspec | |
| 7 7 |  | 
| 8 8 | 
             
            group :test do
         | 
| 9 9 | 
             
              # Pin these dependencies, otherwise a new rule could break the CI pipelines
         | 
| 10 | 
            -
              gem 'rubocop', ' | 
| 11 | 
            -
              gem 'rubocop-rspec', ' | 
| 12 | 
            -
              gem 'rspec-parameterized', '0. | 
| 10 | 
            +
              gem 'rubocop', '1.36.0'
         | 
| 11 | 
            +
              gem 'rubocop-rspec', '2.12.1'
         | 
| 12 | 
            +
              gem 'rspec-parameterized', '0.5.2', require: false
         | 
| 13 13 | 
             
            end
         | 
    
        data/gitlab-styles.gemspec
    CHANGED
    
    | @@ -22,12 +22,12 @@ Gem::Specification.new do |spec| | |
| 22 22 | 
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 23 23 | 
             
              spec.require_paths = ['lib']
         | 
| 24 24 |  | 
| 25 | 
            -
              spec.add_dependency 'rubocop', '~>  | 
| 25 | 
            +
              spec.add_dependency 'rubocop', '~> 1.36.0'
         | 
| 26 26 | 
             
              spec.add_dependency 'rubocop-gitlab-security', '~> 0.1.1'
         | 
| 27 | 
            -
              spec.add_dependency 'rubocop-graphql', '~> 0. | 
| 28 | 
            -
              spec.add_dependency 'rubocop-performance', '~> 1. | 
| 29 | 
            -
              spec.add_dependency 'rubocop-rails', '~> 2. | 
| 30 | 
            -
              spec.add_dependency 'rubocop-rspec', '~>  | 
| 27 | 
            +
              spec.add_dependency 'rubocop-graphql', '~> 0.14'
         | 
| 28 | 
            +
              spec.add_dependency 'rubocop-performance', '~> 1.14'
         | 
| 29 | 
            +
              spec.add_dependency 'rubocop-rails', '~> 2.15'
         | 
| 30 | 
            +
              spec.add_dependency 'rubocop-rspec', '~> 2.12'
         | 
| 31 31 |  | 
| 32 32 | 
             
              spec.add_development_dependency 'bundler', '~> 2.1'
         | 
| 33 33 | 
             
              spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11.0'
         | 
| @@ -5,11 +5,11 @@ require_relative '../../gitlab/styles/rubocop/model_helpers' | |
| 5 5 | 
             
            module Rubocop
         | 
| 6 6 | 
             
              module Cop
         | 
| 7 7 | 
             
                # Cop that prevents the use of `dependent: ...` in ActiveRecord models.
         | 
| 8 | 
            -
                class ActiveRecordDependent < RuboCop::Cop:: | 
| 8 | 
            +
                class ActiveRecordDependent < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                  include Gitlab::Styles::Rubocop::ModelHelpers
         | 
| 10 10 |  | 
| 11 11 | 
             
                  MSG = 'Do not use `dependent:` to remove associated data, ' \
         | 
| 12 | 
            -
             | 
| 12 | 
            +
                        'use foreign keys with cascading deletes instead.'
         | 
| 13 13 |  | 
| 14 14 | 
             
                  METHOD_NAMES = [:has_many, :has_one, :belongs_to].freeze
         | 
| 15 15 | 
             
                  ALLOWED_OPTIONS = [:restrict_with_error].freeze
         | 
| @@ -5,7 +5,7 @@ require_relative '../../gitlab/styles/rubocop/model_helpers' | |
| 5 5 | 
             
            module Rubocop
         | 
| 6 6 | 
             
              module Cop
         | 
| 7 7 | 
             
                # Cop that prevents the use of `serialize` in ActiveRecord models.
         | 
| 8 | 
            -
                class ActiveRecordSerialize < RuboCop::Cop:: | 
| 8 | 
            +
                class ActiveRecordSerialize < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                  include Gitlab::Styles::Rubocop::ModelHelpers
         | 
| 10 10 |  | 
| 11 11 | 
             
                  MSG = 'Do not store serialized data in the database, use separate columns and/or tables instead'
         | 
| @@ -13,7 +13,7 @@ module Rubocop | |
| 13 13 | 
             
                  def on_send(node)
         | 
| 14 14 | 
             
                    return unless in_model?(node)
         | 
| 15 15 |  | 
| 16 | 
            -
                    add_offense(node | 
| 16 | 
            +
                    add_offense(node.loc.selector) if node.children[1] == :serialize
         | 
| 17 17 | 
             
                  end
         | 
| 18 18 | 
             
                end
         | 
| 19 19 | 
             
              end
         | 
| @@ -20,7 +20,7 @@ module Rubocop | |
| 20 20 | 
             
                #     do_something_else
         | 
| 21 21 | 
             
                #   end
         | 
| 22 22 | 
             
                #
         | 
| 23 | 
            -
                class AvoidReturnFromBlocks < RuboCop::Cop:: | 
| 23 | 
            +
                class AvoidReturnFromBlocks < RuboCop::Cop::Base
         | 
| 24 24 | 
             
                  MSG = 'Do not return from a block, use next or break instead.'
         | 
| 25 25 | 
             
                  DEF_METHODS = %i[define_method lambda].freeze
         | 
| 26 26 | 
             
                  WHITELISTED_METHODS = %i[each each_filename times loop].freeze
         | 
| @@ -38,6 +38,8 @@ module Rubocop | |
| 38 38 | 
             
                    end
         | 
| 39 39 | 
             
                  end
         | 
| 40 40 |  | 
| 41 | 
            +
                  alias_method :on_numblock, :on_block
         | 
| 42 | 
            +
             | 
| 41 43 | 
             
                  private
         | 
| 42 44 |  | 
| 43 45 | 
             
                  def top_block?(node)
         | 
| @@ -4,9 +4,9 @@ module Rubocop | |
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                module CodeReuse
         | 
| 6 6 | 
             
                  # Cop that denies the use of ActiveRecord methods outside of models.
         | 
| 7 | 
            -
                  class ActiveRecord < RuboCop::Cop:: | 
| 7 | 
            +
                  class ActiveRecord < RuboCop::Cop::Base
         | 
| 8 8 | 
             
                    MSG = 'This method can only be used inside an ActiveRecord model: ' \
         | 
| 9 | 
            -
             | 
| 9 | 
            +
                          'https://gitlab.com/gitlab-org/gitlab-foss/issues/49653'
         | 
| 10 10 |  | 
| 11 11 | 
             
                    # Various methods from ActiveRecord::Querying that are denied. We
         | 
| 12 12 | 
             
                    # exclude some generic ones such as `any?` and `first`, as these may
         | 
| @@ -72,7 +72,7 @@ module Rubocop | |
| 72 72 | 
             
                      # `Project.group(:name)`.
         | 
| 73 73 | 
             
                      return if NOT_ALLOWED[send_name] && !first_arg
         | 
| 74 74 |  | 
| 75 | 
            -
                      add_offense(node | 
| 75 | 
            +
                      add_offense(node.loc.selector)
         | 
| 76 76 | 
             
                    end
         | 
| 77 77 | 
             
                  end
         | 
| 78 78 | 
             
                end
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 | 
            -
                #  | 
| 5 | 
            +
                # Makes sure that custom error classes, when empty, are declared
         | 
| 6 6 | 
             
                # with Class.new.
         | 
| 7 7 | 
             
                #
         | 
| 8 8 | 
             
                # @example
         | 
| @@ -15,7 +15,9 @@ module Rubocop | |
| 15 15 | 
             
                #
         | 
| 16 16 | 
             
                #   # good
         | 
| 17 17 | 
             
                #   FooError = Class.new(StandardError)
         | 
| 18 | 
            -
                class CustomErrorClass < RuboCop::Cop:: | 
| 18 | 
            +
                class CustomErrorClass < RuboCop::Cop::Base
         | 
| 19 | 
            +
                  extend RuboCop::Cop::AutoCorrector
         | 
| 20 | 
            +
             | 
| 19 21 | 
             
                  MSG = 'Use `Class.new(SuperClass)` to define an empty custom error class.'
         | 
| 20 22 |  | 
| 21 23 | 
             
                  def on_class(node)
         | 
| @@ -28,16 +30,12 @@ module Rubocop | |
| 28 30 |  | 
| 29 31 | 
             
                    return unless parent_klass&.to_s&.end_with?('Error')
         | 
| 30 32 |  | 
| 31 | 
            -
                    add_offense(node)
         | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
                  def autocorrect(node)
         | 
| 35 | 
            -
                    klass = node.identifier
         | 
| 36 | 
            -
                    parent = node.parent_class
         | 
| 33 | 
            +
                    add_offense(node) do |corrector|
         | 
| 34 | 
            +
                      klass = node.identifier
         | 
| 35 | 
            +
                      parent = node.parent_class
         | 
| 37 36 |  | 
| 38 | 
            -
             | 
| 37 | 
            +
                      replacement = "#{class_name_from_node(klass)} = Class.new(#{class_name_from_node(parent)})"
         | 
| 39 38 |  | 
| 40 | 
            -
                    lambda do |corrector|
         | 
| 41 39 | 
             
                      corrector.replace(node.source_range, replacement)
         | 
| 42 40 | 
             
                    end
         | 
| 43 41 | 
             
                  end
         | 
| @@ -2,10 +2,10 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 | 
            -
                #  | 
| 5 | 
            +
                # Prevents usage of the `git` and `github` arguments to `gem` in a
         | 
| 6 6 | 
             
                # `Gemfile` in order to avoid additional points of failure beyond
         | 
| 7 7 | 
             
                # rubygems.org.
         | 
| 8 | 
            -
                class GemFetcher < RuboCop::Cop:: | 
| 8 | 
            +
                class GemFetcher < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                  MSG = 'Do not use gems from git repositories, only use gems from RubyGems.'
         | 
| 10 10 |  | 
| 11 11 | 
             
                  GIT_KEYS = [:git, :github].freeze
         | 
| @@ -18,7 +18,7 @@ module Rubocop | |
| 18 18 |  | 
| 19 19 | 
             
                    node.children.last.each_node(:pair) do |pair|
         | 
| 20 20 | 
             
                      key_name = pair.children[0].children[0].to_sym
         | 
| 21 | 
            -
                      add_offense( | 
| 21 | 
            +
                      add_offense(pair.source_range) if GIT_KEYS.include?(key_name)
         | 
| 22 22 | 
             
                    end
         | 
| 23 23 | 
             
                  end
         | 
| 24 24 |  | 
| @@ -5,13 +5,13 @@ require_relative '../../gitlab/styles/rubocop/model_helpers' | |
| 5 5 | 
             
            module Rubocop
         | 
| 6 6 | 
             
              module Cop
         | 
| 7 7 | 
             
                # Cop that prevents the use of `in_batches`
         | 
| 8 | 
            -
                class InBatches < RuboCop::Cop:: | 
| 8 | 
            +
                class InBatches < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                  MSG = 'Do not use `in_batches`, use `each_batch` from the EachBatch module instead'
         | 
| 10 10 |  | 
| 11 11 | 
             
                  def on_send(node)
         | 
| 12 12 | 
             
                    return unless node.children[1] == :in_batches
         | 
| 13 13 |  | 
| 14 | 
            -
                    add_offense(node | 
| 14 | 
            +
                    add_offense(node.loc.selector)
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 | 
             
                end
         | 
| 17 17 | 
             
              end
         | 
| @@ -4,18 +4,21 @@ module Rubocop | |
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                module InternalAffairs
         | 
| 6 6 | 
             
                  # Cop that denies the use of CopHelper.
         | 
| 7 | 
            -
                  class DeprecateCopHelper < RuboCop::Cop:: | 
| 7 | 
            +
                  class DeprecateCopHelper < RuboCop::Cop::Base
         | 
| 8 8 | 
             
                    MSG = 'Do not use `CopHelper` or methods from it, use improved patterns described in https://www.rubydoc.info/gems/rubocop/RuboCop/RSpec/ExpectOffense'
         | 
| 9 9 |  | 
| 10 | 
            +
                    # @!method cop_helper(node)
         | 
| 10 11 | 
             
                    def_node_matcher :cop_helper, <<~PATTERN
         | 
| 11 12 | 
             
                      (send nil? ${:include :extend :prepend}
         | 
| 12 13 | 
             
                        (const _ {:CopHelper}))
         | 
| 13 14 | 
             
                    PATTERN
         | 
| 14 15 |  | 
| 16 | 
            +
                    # @!method cop_helper_method(node)
         | 
| 15 17 | 
             
                    def_node_search :cop_helper_method, <<~PATTERN
         | 
| 16 18 | 
             
                      (send nil? {:inspect_source :inspect_source_file :parse_source :autocorrect_source_file :autocorrect_source :_investigate} ...)
         | 
| 17 19 | 
             
                    PATTERN
         | 
| 18 20 |  | 
| 21 | 
            +
                    # @!method cop_helper_method_on_instance(node)
         | 
| 19 22 | 
             
                    def_node_search :cop_helper_method_on_instance, <<~PATTERN
         | 
| 20 23 | 
             
                      (send (send nil? _) {:messages :highlights :offenses} ...)
         | 
| 21 24 | 
             
                    PATTERN
         | 
| @@ -55,9 +55,10 @@ module Rubocop | |
| 55 55 | 
             
                #   end
         | 
| 56 56 | 
             
                #
         | 
| 57 57 | 
             
                #   do_something_more
         | 
| 58 | 
            -
                class LineBreakAfterGuardClauses < RuboCop::Cop:: | 
| 58 | 
            +
                class LineBreakAfterGuardClauses < RuboCop::Cop::Base
         | 
| 59 59 | 
             
                  MSG = 'Add a line break after guard clauses'
         | 
| 60 60 |  | 
| 61 | 
            +
                  # @!method guard_clause_node?(node)
         | 
| 61 62 | 
             
                  def_node_matcher :guard_clause_node?, <<-PATTERN
         | 
| 62 63 | 
             
                    [{(send nil? {:raise :fail :throw} ...) return break next} single_line?]
         | 
| 63 64 | 
             
                  PATTERN
         | 
| @@ -42,7 +42,8 @@ module Rubocop | |
| 42 42 | 
             
                #        do_something
         | 
| 43 43 | 
             
                #      end
         | 
| 44 44 | 
             
                #    end
         | 
| 45 | 
            -
                class LineBreakAroundConditionalBlock < RuboCop::Cop:: | 
| 45 | 
            +
                class LineBreakAroundConditionalBlock < RuboCop::Cop::Base
         | 
| 46 | 
            +
                  extend RuboCop::Cop::AutoCorrector
         | 
| 46 47 | 
             
                  include RuboCop::Cop::RangeHelp
         | 
| 47 48 |  | 
| 48 49 | 
             
                  MSG = 'Add a line break around conditional blocks'
         | 
| @@ -53,17 +54,15 @@ module Rubocop | |
| 53 54 | 
             
                    return if node.single_line?
         | 
| 54 55 | 
             
                    return unless node.if? || node.unless?
         | 
| 55 56 |  | 
| 56 | 
            -
                     | 
| 57 | 
            -
                    add_offense(node) unless last_line_valid?(node)
         | 
| 58 | 
            -
                  end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                  def autocorrect(node)
         | 
| 61 | 
            -
                    lambda do |corrector|
         | 
| 57 | 
            +
                    corrector_block = lambda do |corrector|
         | 
| 62 58 | 
             
                      line = range_by_whole_lines(node.source_range)
         | 
| 63 59 |  | 
| 64 60 | 
             
                      corrector.insert_before(line, "\n") unless previous_line_valid?(node)
         | 
| 65 61 | 
             
                      corrector.insert_after(line, "\n") unless last_line_valid?(node)
         | 
| 66 62 | 
             
                    end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    add_offense(node, &corrector_block) unless previous_line_valid?(node)
         | 
| 65 | 
            +
                    add_offense(node, &corrector_block) unless last_line_valid?(node)
         | 
| 67 66 | 
             
                  end
         | 
| 68 67 |  | 
| 69 68 | 
             
                  private
         | 
| @@ -4,7 +4,7 @@ require_relative '../../../gitlab/styles/rubocop/migration_helpers' | |
| 4 4 | 
             
            module Rubocop
         | 
| 5 5 | 
             
              module Cop
         | 
| 6 6 | 
             
                module Migration
         | 
| 7 | 
            -
                  #  | 
| 7 | 
            +
                  # Checks for methods that may lead to batch type issues on a table that's been
         | 
| 8 8 | 
             
                  # explicitly denied because of its size.
         | 
| 9 9 | 
             
                  #
         | 
| 10 10 | 
             
                  # Even though though these methods perform functions to avoid
         | 
| @@ -13,13 +13,14 @@ module Rubocop | |
| 13 13 | 
             
                  #
         | 
| 14 14 | 
             
                  # See https://gitlab.com/gitlab-com/infrastructure/issues/1602 for more
         | 
| 15 15 | 
             
                  # information.
         | 
| 16 | 
            -
                  class UpdateLargeTable < RuboCop::Cop:: | 
| 16 | 
            +
                  class UpdateLargeTable < RuboCop::Cop::Base
         | 
| 17 17 | 
             
                    include Gitlab::Styles::Rubocop::MigrationHelpers
         | 
| 18 18 |  | 
| 19 19 | 
             
                    MSG = 'Using `%s` on the `%s` table will take a long time to ' \
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 20 | 
            +
                          'complete, and should be avoided unless absolutely ' \
         | 
| 21 | 
            +
                          'necessary'
         | 
| 22 22 |  | 
| 23 | 
            +
                    # @!method batch_update?(node)
         | 
| 23 24 | 
             
                    def_node_matcher :batch_update?, <<~PATTERN
         | 
| 24 25 | 
             
                      (send nil? ${#denied_method?}
         | 
| 25 26 | 
             
                        (sym $...)
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                module Performance
         | 
| 6 | 
            -
                  #  | 
| 6 | 
            +
                  # Flags inefficient uses of rubyzip's Zip::File, since when instantiated
         | 
| 7 7 | 
             
                  # it reads the file's Central Directory into memory entirely. For zips with many
         | 
| 8 8 | 
             
                  # files and directories, this can be very expensive even when the archive's size
         | 
| 9 9 | 
             
                  # in bytes is small.
         | 
| @@ -11,13 +11,14 @@ module Rubocop | |
| 11 11 | 
             
                  # See also:
         | 
| 12 12 | 
             
                  # - https://github.com/rubyzip/rubyzip/issues/506
         | 
| 13 13 | 
             
                  # - https://github.com/rubyzip/rubyzip#notes-on-zipinputstream
         | 
| 14 | 
            -
                  class Rubyzip < RuboCop::Cop:: | 
| 14 | 
            +
                  class Rubyzip < RuboCop::Cop::Base
         | 
| 15 15 | 
             
                    MSG = 'Be careful when opening or iterating zip files via Zip::File. ' \
         | 
| 16 16 | 
             
                          'Zip archives may contain many entries, and their file index is ' \
         | 
| 17 17 | 
             
                          'read into memory upon construction, which can lead to ' \
         | 
| 18 18 | 
             
                          'high memory use and poor performance. ' \
         | 
| 19 19 | 
             
                          'Consider iterating archive entries via Zip::InputStream instead.'
         | 
| 20 20 |  | 
| 21 | 
            +
                    # @!method reads_central_directory?(node)
         | 
| 21 22 | 
             
                    def_node_matcher :reads_central_directory?, <<-PATTERN
         | 
| 22 23 | 
             
                      (send
         | 
| 23 24 | 
             
                        (const
         | 
| @@ -5,7 +5,7 @@ require_relative '../../gitlab/styles/rubocop/model_helpers' | |
| 5 5 | 
             
            module Rubocop
         | 
| 6 6 | 
             
              module Cop
         | 
| 7 7 | 
             
                # Cop that prevents the use of polymorphic associations
         | 
| 8 | 
            -
                class PolymorphicAssociations < RuboCop::Cop:: | 
| 8 | 
            +
                class PolymorphicAssociations < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                  include Gitlab::Styles::Rubocop::ModelHelpers
         | 
| 10 10 |  | 
| 11 11 | 
             
                  MSG = 'Do not use polymorphic associations, use separate tables instead'
         | 
| @@ -5,7 +5,7 @@ require_relative '../../../gitlab/styles/rubocop/model_helpers' | |
| 5 5 | 
             
            module Rubocop
         | 
| 6 6 | 
             
              module Cop
         | 
| 7 7 | 
             
                module Rails
         | 
| 8 | 
            -
                  class IncludeUrlHelper < RuboCop::Cop:: | 
| 8 | 
            +
                  class IncludeUrlHelper < RuboCop::Cop::Base
         | 
| 9 9 | 
             
                    MSG = <<~MSG
         | 
| 10 10 | 
             
                      Avoid including `ActionView::Helpers::UrlHelper`.
         | 
| 11 11 | 
             
                      It adds/overrides ~40 methods while usually only one is needed.
         | 
| @@ -14,6 +14,7 @@ module Rubocop | |
| 14 14 | 
             
                      See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
         | 
| 15 15 | 
             
                    MSG
         | 
| 16 16 |  | 
| 17 | 
            +
                    # @!method include_url_helpers_node?(node)
         | 
| 17 18 | 
             
                    def_node_matcher :include_url_helpers_node?, <<~PATTERN
         | 
| 18 19 | 
             
                      (send nil? :include (const (const (const {nil? cbase} :ActionView) :Helpers) :UrlHelper))
         | 
| 19 20 | 
             
                    PATTERN
         | 
| @@ -2,9 +2,9 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 | 
            -
                #  | 
| 5 | 
            +
                # Prevents usage of 'redirect_to' in actions 'destroy' without specifying 'status'.
         | 
| 6 6 | 
             
                # See https://gitlab.com/gitlab-org/gitlab-ce/issues/31840
         | 
| 7 | 
            -
                class RedirectWithStatus < RuboCop::Cop:: | 
| 7 | 
            +
                class RedirectWithStatus < RuboCop::Cop::Base
         | 
| 8 8 | 
             
                  MSG = 'Do not use "redirect_to" without "status" in "destroy" action'
         | 
| 9 9 |  | 
| 10 10 | 
             
                  def on_def(node)
         | 
| @@ -20,7 +20,7 @@ module Rubocop | |
| 20 20 | 
             
                        methods << pair.children.first.children.first
         | 
| 21 21 | 
             
                      end
         | 
| 22 22 |  | 
| 23 | 
            -
                      add_offense(def_node | 
| 23 | 
            +
                      add_offense(def_node.loc.selector) unless methods.include?(:status)
         | 
| 24 24 | 
             
                    end
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 |  | 
| @@ -1,13 +1,11 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'rubocop-rspec'
         | 
| 4 | 
            -
            require_relative '../../../gitlab/styles/rubocop/rspec/helpers'
         | 
| 5 4 |  | 
| 6 5 | 
             
            module Rubocop
         | 
| 7 6 | 
             
              module Cop
         | 
| 8 7 | 
             
                module RSpec
         | 
| 9 8 | 
             
                  class Base < RuboCop::Cop::RSpec::Base
         | 
| 10 | 
            -
                    include Gitlab::Styles::Rubocop::Rspec::Helpers
         | 
| 11 9 | 
             
                  end
         | 
| 12 10 | 
             
                end
         | 
| 13 11 | 
             
              end
         | 
| @@ -39,22 +39,22 @@ module Rubocop | |
| 39 39 | 
             
                  #
         | 
| 40 40 | 
             
                  class EmptyLineAfterLetBlock < Base
         | 
| 41 41 | 
             
                    extend RuboCop::Cop::AutoCorrector
         | 
| 42 | 
            -
                    include RuboCop::RSpec::EmptyLineSeparation
         | 
| 42 | 
            +
                    include RuboCop::Cop::RSpec::EmptyLineSeparation
         | 
| 43 43 |  | 
| 44 44 | 
             
                    MSG = 'Add an empty line after `%<let>s` block.'
         | 
| 45 45 |  | 
| 46 | 
            -
                    def_node_matcher :lets, LET.block_pattern
         | 
| 47 | 
            -
             | 
| 48 46 | 
             
                    def on_block(node)
         | 
| 49 | 
            -
                       | 
| 50 | 
            -
                        break if last_child?( | 
| 51 | 
            -
                        next if  | 
| 47 | 
            +
                      RuboCop::RSpec::ExampleGroup.new(node).lets.each do |let|
         | 
| 48 | 
            +
                        break if last_child?(let)
         | 
| 49 | 
            +
                        next if let.single_line?
         | 
| 52 50 |  | 
| 53 | 
            -
                        missing_separating_line_offense( | 
| 51 | 
            +
                        missing_separating_line_offense(let) do |method|
         | 
| 52 | 
            +
                          format(MSG, let: method)
         | 
| 54 53 | 
             
                          format(MSG, let: method)
         | 
| 55 54 | 
             
                        end
         | 
| 56 55 | 
             
                      end
         | 
| 57 56 | 
             
                    end
         | 
| 57 | 
            +
                    alias_method :on_numblock, :on_block
         | 
| 58 58 | 
             
                  end
         | 
| 59 59 | 
             
                end
         | 
| 60 60 | 
             
              end
         | 
| @@ -39,12 +39,13 @@ module Rubocop | |
| 39 39 | 
             
                  #
         | 
| 40 40 | 
             
                  class EmptyLineAfterSharedExample < Base
         | 
| 41 41 | 
             
                    extend RuboCop::Cop::AutoCorrector
         | 
| 42 | 
            -
                    include RuboCop::RSpec::EmptyLineSeparation
         | 
| 42 | 
            +
                    include RuboCop::Cop::RSpec::EmptyLineSeparation
         | 
| 43 43 |  | 
| 44 44 | 
             
                    MSG = 'Add an empty line after `%<example>s` block.'
         | 
| 45 45 |  | 
| 46 | 
            +
                    # @!method shared_examples(node)
         | 
| 46 47 | 
             
                    def_node_matcher :shared_examples,
         | 
| 47 | 
            -
                                     (SharedGroups | 
| 48 | 
            +
                                     block_pattern('{#SharedGroups.all #Includes.all}')
         | 
| 48 49 |  | 
| 49 50 | 
             
                    def on_block(node)
         | 
| 50 51 | 
             
                      shared_examples(node) do
         | 
| @@ -55,6 +56,7 @@ module Rubocop | |
| 55 56 | 
             
                        end
         | 
| 56 57 | 
             
                      end
         | 
| 57 58 | 
             
                    end
         | 
| 59 | 
            +
                    alias_method :on_numblock, :on_block
         | 
| 58 60 | 
             
                  end
         | 
| 59 61 | 
             
                end
         | 
| 60 62 | 
             
              end
         | 
| @@ -52,6 +52,7 @@ module Rubocop | |
| 52 52 |  | 
| 53 53 | 
             
                    MSG = 'Only start words with lowercase alpha with no leading/trailing spaces when describing your tests.'
         | 
| 54 54 |  | 
| 55 | 
            +
                    # @!method it_description(node)
         | 
| 55 56 | 
             
                    def_node_matcher :it_description, <<-PATTERN
         | 
| 56 57 | 
             
                  (block (send _ :it ${
         | 
| 57 58 | 
             
                    (str $_)
         | 
| @@ -64,6 +65,7 @@ module Rubocop | |
| 64 65 | 
             
                        add_wording_offense(description_node, MSG) if invalid_description?(text(description_node))
         | 
| 65 66 | 
             
                      end
         | 
| 66 67 | 
             
                    end
         | 
| 68 | 
            +
                    alias_method :on_numblock, :on_block
         | 
| 67 69 |  | 
| 68 70 | 
             
                    private
         | 
| 69 71 |  | 
| @@ -6,7 +6,7 @@ require_relative 'base' | |
| 6 6 | 
             
            module Rubocop
         | 
| 7 7 | 
             
              module Cop
         | 
| 8 8 | 
             
                module RSpec
         | 
| 9 | 
            -
                  #  | 
| 9 | 
            +
                  # Checks for unused parameters to the `have_link` matcher.
         | 
| 10 10 | 
             
                  #
         | 
| 11 11 | 
             
                  # @example
         | 
| 12 12 | 
             
                  #
         | 
| @@ -21,6 +21,7 @@ module Rubocop | |
| 21 21 |  | 
| 22 22 | 
             
                    MESSAGE = "The second argument to `have_link` should be a Hash."
         | 
| 23 23 |  | 
| 24 | 
            +
                    # @!method unused_parameters?(node)
         | 
| 24 25 | 
             
                    def_node_matcher :unused_parameters?, <<~PATTERN
         | 
| 25 26 | 
             
                      (send nil? :have_link
         | 
| 26 27 | 
             
                        _ !{hash nil}
         | 
| @@ -6,7 +6,7 @@ require_relative 'base' | |
| 6 6 | 
             
            module Rubocop
         | 
| 7 7 | 
             
              module Cop
         | 
| 8 8 | 
             
                module RSpec
         | 
| 9 | 
            -
                  #  | 
| 9 | 
            +
                  # Checks for single-line hook blocks
         | 
| 10 10 | 
             
                  #
         | 
| 11 11 | 
             
                  # @example
         | 
| 12 12 | 
             
                  #
         | 
| @@ -25,6 +25,7 @@ module Rubocop | |
| 25 25 | 
             
                  class SingleLineHook < Base
         | 
| 26 26 | 
             
                    MESSAGE = "Don't use single-line hook blocks."
         | 
| 27 27 |  | 
| 28 | 
            +
                    # @!method rspec_hook?(node)
         | 
| 28 29 | 
             
                    def_node_search :rspec_hook?, <<~PATTERN
         | 
| 29 30 | 
             
                      (send nil? {:after :around :before} ...)
         | 
| 30 31 | 
             
                    PATTERN
         | 
| @@ -35,6 +36,7 @@ module Rubocop | |
| 35 36 |  | 
| 36 37 | 
             
                      add_offense(node, message: MESSAGE)
         | 
| 37 38 | 
             
                    end
         | 
| 39 | 
            +
                    alias_method :on_numblock, :on_block
         | 
| 38 40 | 
             
                  end
         | 
| 39 41 | 
             
                end
         | 
| 40 42 | 
             
              end
         | 
| @@ -23,6 +23,7 @@ module Rubocop | |
| 23 23 |  | 
| 24 24 | 
             
                    SELECTORS = %i[describe context feature example_group it specify example scenario its].freeze
         | 
| 25 25 |  | 
| 26 | 
            +
                    # @!method include_metadata(node)
         | 
| 26 27 | 
             
                    def_node_matcher :include_metadata, <<-PATTERN
         | 
| 27 28 | 
             
                      (send {(const nil? :RSpec) nil?} {#{SELECTORS.map(&:inspect).join(' ')}}
         | 
| 28 29 | 
             
                        !const
         | 
| @@ -30,6 +31,7 @@ module Rubocop | |
| 30 31 | 
             
                        (hash $...))
         | 
| 31 32 | 
             
                    PATTERN
         | 
| 32 33 |  | 
| 34 | 
            +
                    # @!method invalid_metadata?(node)
         | 
| 33 35 | 
             
                    def_node_matcher :invalid_metadata?, <<-PATTERN
         | 
| 34 36 | 
             
                      (pair
         | 
| 35 37 | 
             
                        (sym $...)
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                module Style
         | 
| 6 | 
            -
                  #  | 
| 6 | 
            +
                  # Identifies places where `map { ... }.to_h` or
         | 
| 7 7 | 
             
                  # `Hash[map { ... }]` can be replaced with `to_h { ... }`,
         | 
| 8 8 | 
             
                  # saving an intermediate array allocation.
         | 
| 9 9 | 
             
                  #
         | 
| @@ -20,11 +20,13 @@ module Rubocop | |
| 20 20 | 
             
                  #   array.to_h { |x| [x, x + 1] }
         | 
| 21 21 | 
             
                  #
         | 
| 22 22 | 
             
                  # Full credit: https://github.com/eugeneius/rubocop-performance/blob/hash_transformation/lib/rubocop/cop/performance/hash_transformation.rb
         | 
| 23 | 
            -
                  class HashTransformation < RuboCop::Cop:: | 
| 23 | 
            +
                  class HashTransformation < RuboCop::Cop::Base
         | 
| 24 | 
            +
                    extend RuboCop::Cop::AutoCorrector
         | 
| 24 25 | 
             
                    include RuboCop::Cop::RangeHelp
         | 
| 25 26 |  | 
| 26 27 | 
             
                    MSG = 'Use `to_h { ... }` instead of `%<current>s`.'
         | 
| 27 28 |  | 
| 29 | 
            +
                    # @!method to_h_candidate?(node)
         | 
| 28 30 | 
             
                    def_node_matcher :to_h_candidate?, <<~PATTERN
         | 
| 29 31 | 
             
                      {
         | 
| 30 32 | 
             
                        [(send
         | 
| @@ -38,17 +40,13 @@ module Rubocop | |
| 38 40 | 
             
                      to_h_candidate?(node) do |_block, call|
         | 
| 39 41 | 
             
                        range = offense_range(node, call)
         | 
| 40 42 | 
             
                        message = message(node, call)
         | 
| 41 | 
            -
                        add_offense( | 
| 42 | 
            -
             | 
| 43 | 
            -
                    end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                    def autocorrect(node)
         | 
| 46 | 
            -
                      block, call = to_h_candidate?(node)
         | 
| 43 | 
            +
                        add_offense(range, message: message) do |corrector|
         | 
| 44 | 
            +
                          block, call = to_h_candidate?(node)
         | 
| 47 45 |  | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
                         | 
| 46 | 
            +
                          corrector.remove(after_block(node, block))
         | 
| 47 | 
            +
                          corrector.replace(call.loc.selector, 'to_h')
         | 
| 48 | 
            +
                          corrector.remove(before_block(node, block))
         | 
| 49 | 
            +
                        end
         | 
| 52 50 | 
             
                      end
         | 
| 53 51 | 
             
                    end
         | 
| 54 52 |  | 
| @@ -3,18 +3,19 @@ | |
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                module Style
         | 
| 6 | 
            -
                  #  | 
| 6 | 
            +
                  # Flags uses of OpenStruct, as it is now officially discouraged
         | 
| 7 7 | 
             
                  # to be used for performance, version compatibility, and potential security issues.
         | 
| 8 8 | 
             
                  #
         | 
| 9 9 | 
             
                  # See also:
         | 
| 10 10 | 
             
                  # - https://rubyreferences.github.io/rubychanges/3.0.html#standard-library
         | 
| 11 11 | 
             
                  # - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
         | 
| 12 12 | 
             
                  # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67855
         | 
| 13 | 
            -
                  class OpenStructUse < RuboCop::Cop:: | 
| 13 | 
            +
                  class OpenStructUse < RuboCop::Cop::Base
         | 
| 14 14 | 
             
                    MSG = 'Avoid using `OpenStruct`. It is officially discouraged. ' \
         | 
| 15 15 | 
             
                          'Replace it with `Struct`, `Hash`, or RSpec doubles. ' \
         | 
| 16 16 | 
             
                          'See https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats'
         | 
| 17 17 |  | 
| 18 | 
            +
                    # @!method uses_open_struct?(node)
         | 
| 18 19 | 
             
                    def_node_matcher :uses_open_struct?, <<-PATTERN
         | 
| 19 20 | 
             
                      (const {nil? (cbase)} :OpenStruct)
         | 
| 20 21 | 
             
                    PATTERN
         | 
| @@ -3,13 +3,13 @@ | |
| 3 3 | 
             
            module Rubocop
         | 
| 4 4 | 
             
              module Cop
         | 
| 5 5 | 
             
                # Cop that prevents the use of `without_reactive_cache`
         | 
| 6 | 
            -
                class WithoutReactiveCache < RuboCop::Cop:: | 
| 6 | 
            +
                class WithoutReactiveCache < RuboCop::Cop::Base
         | 
| 7 7 | 
             
                  MSG = 'without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.'
         | 
| 8 8 |  | 
| 9 9 | 
             
                  def on_send(node)
         | 
| 10 10 | 
             
                    return unless node.children[1] == :without_reactive_cache
         | 
| 11 11 |  | 
| 12 | 
            -
                    add_offense(node | 
| 12 | 
            +
                    add_offense(node.loc.selector)
         | 
| 13 13 | 
             
                  end
         | 
| 14 14 | 
             
                end
         | 
| 15 15 | 
             
              end
         | 
    
        data/rubocop-layout.yml
    CHANGED
    
    | @@ -135,7 +135,7 @@ Layout/LeadingCommentSpace: | |
| 135 135 | 
             
            Layout/LineLength:
         | 
| 136 136 | 
             
              Enabled: true
         | 
| 137 137 | 
             
              Max: 120
         | 
| 138 | 
            -
               | 
| 138 | 
            +
              AllowedPatterns: ['\s#\srubocop']
         | 
| 139 139 |  | 
| 140 140 | 
             
            # Checks that the closing brace in an array literal is either on the same line
         | 
| 141 141 | 
             
            # as the last array element, or a new line.
         | 
    
        data/rubocop-rspec.yml
    CHANGED
    
    | @@ -34,11 +34,6 @@ RSpec/DescribedClass: | |
| 34 34 | 
             
            # Checks if an example group does not include any tests.
         | 
| 35 35 | 
             
            RSpec/EmptyExampleGroup:
         | 
| 36 36 | 
             
              Enabled: true
         | 
| 37 | 
            -
              CustomIncludeMethods:
         | 
| 38 | 
            -
                - run_permission_checks
         | 
| 39 | 
            -
                - run_group_permission_checks
         | 
| 40 | 
            -
                - it_should_email!
         | 
| 41 | 
            -
                - it_should_not_email!
         | 
| 42 37 |  | 
| 43 38 | 
             
            # Checks if there is an empty line after let blocks.
         | 
| 44 39 | 
             
            RSpec/EmptyLineAfterLetBlock:
         | 
| @@ -159,3 +154,16 @@ RSpec/SubjectStub: | |
| 159 154 | 
             
            # Prefer using verifying doubles over normal doubles.
         | 
| 160 155 | 
             
            RSpec/VerifiedDoubles:
         | 
| 161 156 | 
             
              Enabled: true
         | 
| 157 | 
            +
             | 
| 158 | 
            +
            RSpec:
         | 
| 159 | 
            +
              Language:
         | 
| 160 | 
            +
                Helpers:
         | 
| 161 | 
            +
                  - let_it_be
         | 
| 162 | 
            +
                  - let_it_be_with_refind
         | 
| 163 | 
            +
                  - let_it_be_with_reload
         | 
| 164 | 
            +
                Includes:
         | 
| 165 | 
            +
                  Examples:
         | 
| 166 | 
            +
                    - run_permission_checks
         | 
| 167 | 
            +
                    - run_group_permission_checks
         | 
| 168 | 
            +
                    - it_should_email!
         | 
| 169 | 
            +
                    - it_should_not_email!
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gitlab-styles
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 9.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - GitLab
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022-09- | 
| 11 | 
            +
            date: 2022-09-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rubocop
         | 
| @@ -16,20 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 20 | 
            -
                - - ">="
         | 
| 21 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            -
                    version: 0.91.1
         | 
| 19 | 
            +
                    version: 1.36.0
         | 
| 23 20 | 
             
              type: :runtime
         | 
| 24 21 | 
             
              prerelease: false
         | 
| 25 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 24 | 
             
                - - "~>"
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version:  | 
| 30 | 
            -
                - - ">="
         | 
| 31 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            -
                    version: 0.91.1
         | 
| 26 | 
            +
                    version: 1.36.0
         | 
| 33 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 28 | 
             
              name: rubocop-gitlab-security
         | 
| 35 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -50,56 +44,56 @@ dependencies: | |
| 50 44 | 
             
                requirements:
         | 
| 51 45 | 
             
                - - "~>"
         | 
| 52 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version: '0. | 
| 47 | 
            +
                    version: '0.14'
         | 
| 54 48 | 
             
              type: :runtime
         | 
| 55 49 | 
             
              prerelease: false
         | 
| 56 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 51 | 
             
                requirements:
         | 
| 58 52 | 
             
                - - "~>"
         | 
| 59 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 60 | 
            -
                    version: '0. | 
| 54 | 
            +
                    version: '0.14'
         | 
| 61 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 62 56 | 
             
              name: rubocop-performance
         | 
| 63 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 64 58 | 
             
                requirements:
         | 
| 65 59 | 
             
                - - "~>"
         | 
| 66 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 67 | 
            -
                    version: 1. | 
| 61 | 
            +
                    version: '1.14'
         | 
| 68 62 | 
             
              type: :runtime
         | 
| 69 63 | 
             
              prerelease: false
         | 
| 70 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 71 65 | 
             
                requirements:
         | 
| 72 66 | 
             
                - - "~>"
         | 
| 73 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 74 | 
            -
                    version: 1. | 
| 68 | 
            +
                    version: '1.14'
         | 
| 75 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 76 70 | 
             
              name: rubocop-rails
         | 
| 77 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 78 72 | 
             
                requirements:
         | 
| 79 73 | 
             
                - - "~>"
         | 
| 80 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 81 | 
            -
                    version: '2. | 
| 75 | 
            +
                    version: '2.15'
         | 
| 82 76 | 
             
              type: :runtime
         | 
| 83 77 | 
             
              prerelease: false
         | 
| 84 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 85 79 | 
             
                requirements:
         | 
| 86 80 | 
             
                - - "~>"
         | 
| 87 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 88 | 
            -
                    version: '2. | 
| 82 | 
            +
                    version: '2.15'
         | 
| 89 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 90 84 | 
             
              name: rubocop-rspec
         | 
| 91 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 92 86 | 
             
                requirements:
         | 
| 93 87 | 
             
                - - "~>"
         | 
| 94 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 95 | 
            -
                    version: ' | 
| 89 | 
            +
                    version: '2.12'
         | 
| 96 90 | 
             
              type: :runtime
         | 
| 97 91 | 
             
              prerelease: false
         | 
| 98 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 99 93 | 
             
                requirements:
         | 
| 100 94 | 
             
                - - "~>"
         | 
| 101 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 102 | 
            -
                    version: ' | 
| 96 | 
            +
                    version: '2.12'
         | 
| 103 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 104 98 | 
             
              name: bundler
         | 
| 105 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -186,7 +180,6 @@ files: | |
| 186 180 | 
             
            - lib/gitlab/styles/rubocop.rb
         | 
| 187 181 | 
             
            - lib/gitlab/styles/rubocop/migration_helpers.rb
         | 
| 188 182 | 
             
            - lib/gitlab/styles/rubocop/model_helpers.rb
         | 
| 189 | 
            -
            - lib/gitlab/styles/rubocop/rspec/helpers.rb
         | 
| 190 183 | 
             
            - lib/gitlab/styles/version.rb
         | 
| 191 184 | 
             
            - lib/rubocop/cop/active_record_dependent.rb
         | 
| 192 185 | 
             
            - lib/rubocop/cop/active_record_serialize.rb
         | 
| @@ -207,7 +200,6 @@ files: | |
| 207 200 | 
             
            - lib/rubocop/cop/rails/include_url_helper.rb
         | 
| 208 201 | 
             
            - lib/rubocop/cop/redirect_with_status.rb
         | 
| 209 202 | 
             
            - lib/rubocop/cop/rspec/base.rb
         | 
| 210 | 
            -
            - lib/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb
         | 
| 211 203 | 
             
            - lib/rubocop/cop/rspec/empty_line_after_let_block.rb
         | 
| 212 204 | 
             
            - lib/rubocop/cop/rspec/empty_line_after_shared_example.rb
         | 
| 213 205 | 
             
            - lib/rubocop/cop/rspec/example_starting_character.rb
         | 
| @@ -1,18 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'rubocop-rspec'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            module Gitlab
         | 
| 6 | 
            -
              module Styles
         | 
| 7 | 
            -
                module Rubocop
         | 
| 8 | 
            -
                  module Rspec
         | 
| 9 | 
            -
                    module Helpers
         | 
| 10 | 
            -
                      include RuboCop::RSpec::Language
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                      LET_IT_BE_HELPERS = SelectorSet.new(%i[let_it_be let_it_be_with_refind let_it_be_with_reload])
         | 
| 13 | 
            -
                      LET = LET_IT_BE_HELPERS + RuboCop::RSpec::Language::Helpers::ALL
         | 
| 14 | 
            -
                    end
         | 
| 15 | 
            -
                  end
         | 
| 16 | 
            -
                end
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
            end
         | 
| @@ -1,47 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'rubocop-rspec'
         | 
| 4 | 
            -
            require_relative 'base'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            module Rubocop
         | 
| 7 | 
            -
              module Cop
         | 
| 8 | 
            -
                module RSpec
         | 
| 9 | 
            -
                  # Checks if there is an empty line after the last `let_it_be` block.
         | 
| 10 | 
            -
                  #
         | 
| 11 | 
            -
                  # @example
         | 
| 12 | 
            -
                  #   # bad
         | 
| 13 | 
            -
                  #   let_it_be(:foo) { bar }
         | 
| 14 | 
            -
                  #   let_it_be(:something) { other }
         | 
| 15 | 
            -
                  #   it { does_something }
         | 
| 16 | 
            -
                  #
         | 
| 17 | 
            -
                  #   # good
         | 
| 18 | 
            -
                  #   let_it_be(:foo) { bar }
         | 
| 19 | 
            -
                  #   let_it_be(:something) { other }
         | 
| 20 | 
            -
                  #
         | 
| 21 | 
            -
                  #   it { does_something }
         | 
| 22 | 
            -
                  class EmptyLineAfterFinalLetItBe < Base
         | 
| 23 | 
            -
                    extend RuboCop::Cop::AutoCorrector
         | 
| 24 | 
            -
                    include RuboCop::RSpec::EmptyLineSeparation
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                    MSG = 'Add an empty line after the last `let_it_be`.'
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                    def_node_matcher :let_it_be?, <<-PATTERN
         | 
| 29 | 
            -
                      {
         | 
| 30 | 
            -
                        (block (send #rspec? {:let_it_be :let_it_be_with_refind :let_it_be_with_reload} ...) ...)
         | 
| 31 | 
            -
                        (send #rspec? {:let_it_be :let_it_be_with_refind :let_it_be_with_reload} _ block_pass)
         | 
| 32 | 
            -
                      }
         | 
| 33 | 
            -
                    PATTERN
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                    def on_block(node)
         | 
| 36 | 
            -
                      return unless example_group_with_body?(node)
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                      final_let_it_be = node.body.child_nodes.reverse.find { |child| let_it_be?(child) }
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                      return if final_let_it_be.nil?
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                      missing_separating_line_offense(final_let_it_be) { MSG }
         | 
| 43 | 
            -
                    end
         | 
| 44 | 
            -
                  end
         | 
| 45 | 
            -
                end
         | 
| 46 | 
            -
              end
         | 
| 47 | 
            -
            end
         |