diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index c094822c7fd606529505f10a08fb99bd7c5080a1..f9a2a94fd064770b815636a56c25294bd7814188 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -51,7 +51,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.5866/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.5869/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parlour-4.0.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/patchelf-1.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" @@ -74,9 +74,9 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10 $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.88.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.7.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.42.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.43.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.5866-universal-darwin-19/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.5866/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.5869-universal-darwin-19/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.5869/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-1.0.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tapioca-0.4.1/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_class.rb deleted file mode 100644 index 6bdf4ffb9ee47e9c052e4dbe6fae208188ec8883..0000000000000000000000000000000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_class.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that the first argument to the top level describe is a constant. - # - # @example - # # bad - # describe 'Do something' do - # end - # - # # good - # describe TestedClass do - # subject { described_class } - # end - # - # describe 'TestedClass::VERSION' do - # subject { Object.const_get(self.class.description) } - # end - # - # describe "A feature example", type: :feature do - # end - class DescribeClass < Cop - include RuboCop::RSpec::TopLevelDescribe - - MSG = 'The first argument to describe should be '\ - 'the class or module being tested.' - - def_node_matcher :valid_describe?, <<-PATTERN - { - (send #{RSPEC} :describe const ...) - (send #{RSPEC} :describe) - } - PATTERN - - def_node_matcher :describe_with_rails_metadata?, <<-PATTERN - (send #{RSPEC} :describe !const ... - (hash <#rails_metadata? ...>) - ) - PATTERN - - def_node_matcher :rails_metadata?, <<-PATTERN - (pair - (sym :type) - (sym { - :channel :controller :helper :job :mailer :model :request - :routing :view :feature :system :mailbox - } - ) - ) - PATTERN - - def on_top_level_describe(node, (described_value, _)) - return if shared_group?(root_node) - return if valid_describe?(node) - return if describe_with_rails_metadata?(node) - return if string_constant_describe?(described_value) - - add_offense(described_value) - end - - private - - def string_constant_describe?(described_value) - described_value.str_type? && - described_value.value =~ /^((::)?[A-Z]\w*)+$/ - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_example_group.rb deleted file mode 100644 index 2d8bb24f498b0684bf296c830f0fb6fbd04c49fd..0000000000000000000000000000000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_example_group.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if an example group does not include any tests. - # - # This cop is configurable using the `CustomIncludeMethods` option - # - # @example usage - # - # # bad - # describe Bacon do - # let(:bacon) { Bacon.new(chunkiness) } - # let(:chunkiness) { false } - # - # context 'extra chunky' do # flagged by rubocop - # let(:chunkiness) { true } - # end - # - # it 'is chunky' do - # expect(bacon.chunky?).to be_truthy - # end - # end - # - # # good - # describe Bacon do - # let(:bacon) { Bacon.new(chunkiness) } - # let(:chunkiness) { false } - # - # it 'is chunky' do - # expect(bacon.chunky?).to be_truthy - # end - # end - # - # @example configuration - # - # # .rubocop.yml - # # RSpec/EmptyExampleGroup: - # # CustomIncludeMethods: - # # - include_tests - # - # # spec_helper.rb - # RSpec.configure do |config| - # config.alias_it_behaves_like_to(:include_tests) - # end - # - # # bacon_spec.rb - # describe Bacon do - # let(:bacon) { Bacon.new(chunkiness) } - # let(:chunkiness) { false } - # - # context 'extra chunky' do # not flagged by rubocop - # let(:chunkiness) { true } - # - # include_tests 'shared tests' - # end - # end - # - class EmptyExampleGroup < Cop - MSG = 'Empty example group detected.' - - def_node_search :contains_example?, <<-PATTERN - { - #{(Examples::ALL + Includes::ALL).send_pattern} - (send _ #custom_include? ...) - } - PATTERN - - def on_block(node) - return unless example_group?(node) && !contains_example?(node) - - add_offense(node.send_node) - end - - private - - def custom_include?(method_name) - custom_include_methods.include?(method_name) - end - - def custom_include_methods - cop_config - .fetch('CustomIncludeMethods', []) - .map(&:to_sym) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_name.rb deleted file mode 100644 index 7fa222805df86f04fddbc171cbc78ba11a832c1a..0000000000000000000000000000000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_name.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that memoized helper names use the configured style. - # - # @example EnforcedStyle: snake_case (default) - # # bad - # let(:userName) { 'Adam' } - # subject(:userName) { 'Adam' } - # - # # good - # let(:user_name) { 'Adam' } - # subject(:user_name) { 'Adam' } - # - # @example EnforcedStyle: camelCase - # # bad - # let(:user_name) { 'Adam' } - # subject(:user_name) { 'Adam' } - # - # # good - # let(:userName) { 'Adam' } - # subject(:userName) { 'Adam' } - class VariableName < Cop - include ConfigurableNaming - include RuboCop::RSpec::Variable - - MSG = 'Use %<style>s for variable names.' - - def on_send(node) - variable_definition?(node) do |variable| - return if variable.dstr_type? || variable.dsym_type? - - check_name(node, variable.value, variable.loc.expression) - end - end - - private - - def message(style) - format(MSG, style: style) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_group.rb deleted file mode 100644 index 356b4f8b29b3124fe98a01d46a16c6aa1856a656..0000000000000000000000000000000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_group.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module RSpec - # Helper methods for top level example group cops - module TopLevelGroup - extend RuboCop::NodePattern::Macros - include RuboCop::RSpec::Language - - def_node_matcher :example_or_shared_group?, - (ExampleGroups::ALL + SharedGroups::ALL).block_pattern - - def on_block(node) - return unless respond_to?(:on_top_level_group) - return unless top_level_group?(node) - - on_top_level_group(node) - end - - private - - def top_level_group?(node) - top_level_groups.include?(node) - end - - def top_level_groups - @top_level_groups ||= - top_level_nodes.select { |n| example_or_shared_group?(n) } - end - - def top_level_nodes - if root_node.begin_type? - root_node.children - else - [root_node] - end - end - - def root_node - processed_source.ast - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/config/default.yml similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/config/default.yml index bd689553f51e7704b4a27cdfbce9b5c6c2d54178..289357e13833c122951d4172d6c5d852c9639004 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/config/default.yml @@ -74,7 +74,7 @@ RSpec/ContextWording: StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording RSpec/DescribeClass: - Description: Check that the first argument to the top level describe is a constant. + Description: Check that the first argument to the top-level describe is a constant. Enabled: true VersionAdded: '1.0' StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass @@ -381,7 +381,7 @@ RSpec/MissingExampleGroupArgument: StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument RSpec/MultipleDescribes: - Description: Checks for multiple top level describes. + Description: Checks for multiple top-level example groups. Enabled: true VersionAdded: '1.0' StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes @@ -394,6 +394,14 @@ RSpec/MultipleExpectations: VersionChanged: '1.21' StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations +RSpec/MultipleMemoizedHelpers: + Description: Checks if example groups contain too many `let` and `subject` calls. + Enabled: true + AllowSubject: true + Max: 5 + VersionAdded: '1.43' + StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers + RSpec/MultipleSubjects: Description: Checks if an example group defines `subject` multiple times. Enabled: true @@ -558,7 +566,9 @@ RSpec/VariableName: SupportedStyles: - snake_case - camelCase + IgnoredPatterns: [] VersionAdded: '1.40' + VersionChanged: '1.43' StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName RSpec/VerifiedDoubles: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop-rspec.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop-rspec.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop-rspec.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop-rspec.rb index 93b58644981c8c4c98473645f7166dbea605507d..006e39ee382b5ac98816ddc233d9d83c570e6178 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop-rspec.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop-rspec.rb @@ -19,11 +19,12 @@ require_relative 'rubocop/rspec/example_group' require_relative 'rubocop/rspec/example' require_relative 'rubocop/rspec/hook' require_relative 'rubocop/rspec/variable' +require_relative 'rubocop/cop/rspec/base' require_relative 'rubocop/cop/rspec/cop' require_relative 'rubocop/rspec/align_let_brace' require_relative 'rubocop/rspec/factory_bot' require_relative 'rubocop/rspec/final_end_location' -require_relative 'rubocop/rspec/blank_line_separation' +require_relative 'rubocop/rspec/empty_line_separation' require_relative 'rubocop/rspec/corrector/move_node' RuboCop::RSpec::Inject.defaults! diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_left_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_left_let_brace.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_left_let_brace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_left_let_brace.rb index b2f3076427069e592c76d72682ebaf67075f1307..ebe3189f7d06bbaff9a880b80882921ab34df61c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_left_let_brace.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_left_let_brace.rb @@ -17,7 +17,7 @@ module RuboCop # let(:baz) { bar } # let(:a) { b } # - class AlignLeftLetBrace < Cop + class AlignLeftLetBrace < Base extend AutoCorrector MSG = 'Align left let brace' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_right_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_right_let_brace.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_right_let_brace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_right_let_brace.rb index 387d9507b2ea533f8a2ba93634a49de684540ef6..62c88bc047b859f33fc975b18243eb46997db1b7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/align_right_let_brace.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/align_right_let_brace.rb @@ -17,7 +17,7 @@ module RuboCop # let(:baz) { bar } # let(:a) { b } # - class AlignRightLetBrace < Cop + class AlignRightLetBrace < Base extend AutoCorrector MSG = 'Align right let brace' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/any_instance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/any_instance.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/any_instance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/any_instance.rb index 08c92a867d7a32b6b9261c21ff43b774568ddadf..b622224ceb756d136ef2dcea1d68c902166cd659 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/any_instance.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/any_instance.rb @@ -22,7 +22,7 @@ module RuboCop # allow(my_instance).to receive(:foo) # end # end - class AnyInstance < Cop + class AnyInstance < Base MSG = 'Avoid stubbing using `%<method>s`.' def_node_matcher :disallowed_stub, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/around_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/around_block.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/around_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/around_block.rb index 0dc0063649f8c8cb717ca055f207d01587933762..c606a1060e8a848bb46e0b604fa772cb31cf11fb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/around_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/around_block.rb @@ -25,7 +25,7 @@ module RuboCop # some_method # test.run # end - class AroundBlock < Cop + class AroundBlock < Base MSG_NO_ARG = 'Test object should be passed to around block.' MSG_UNUSED_ARG = 'You should call `%<arg>s.call` '\ 'or `%<arg>s.run`.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/cop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/base.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/cop.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/base.rb index d9f09d4f1103f8a7346889ec02b756b6f9a48086..1df17d4af74b838ac897793be29a43b90e1d2a94 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/cop.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/base.rb @@ -17,7 +17,7 @@ module RuboCop # # Patterns: # # - '_test.rb$' # # - '(?:^|/)test/' - class Cop < ::RuboCop::Cop::Base + class Base < ::RuboCop::Cop::Base include RuboCop::RSpec::Language include RuboCop::RSpec::Language::NodePattern @@ -30,8 +30,8 @@ module RuboCop ) # Invoke the original inherited hook so our cops are recognized - def self.inherited(subclass) - RuboCop::Cop::Cop.inherited(subclass) + def self.inherited(subclass) # rubocop:disable Lint/MissingSuper + RuboCop::Cop::Base.inherited(subclass) end def relevant_file?(file) @@ -41,7 +41,7 @@ module RuboCop private def relevant_rubocop_rspec_file?(file) - rspec_pattern =~ file + rspec_pattern.match?(file) end def rspec_pattern diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be.rb index a70cb0044f501ee78f0849473a1ea07aa1c106ae..5f388c299192a5a99c6a44dda1a618ff168e6f7b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be.rb @@ -19,7 +19,7 @@ module RuboCop # expect(foo).to be 1.0 # expect(foo).to be(true) # - class Be < Cop + class Be < Base MSG = 'Don\'t use `be` without an argument.' def_node_matcher :be_without_args, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be_eql.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be_eql.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be_eql.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be_eql.rb index ad13a904af4447863efa653e9c12e85e0a325195..fbecd4fbbbe2d5fe72b8401d5f3b2a15389f06b8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/be_eql.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/be_eql.rb @@ -35,7 +35,7 @@ module RuboCop # necessarily the same type as `b` since the `#==` operator can # coerce objects for comparison. # - class BeEql < Cop + class BeEql < Base extend AutoCorrector MSG = 'Prefer `be` over `eql`.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/before_after_all.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/before_after_all.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/before_after_all.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/before_after_all.rb index e4809ff93c32d5babd81d5ade11215d52ca63b2e..9a9d894da96eb54f2e00d767fc0fa66adee1e689 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/before_after_all.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/before_after_all.rb @@ -23,7 +23,7 @@ module RuboCop # before(:each) { Widget.create } # after(:each) { Widget.delete_all } # end - class BeforeAfterAll < Cop + class BeforeAfterAll < Base MSG = 'Beware of using `%<hook>s` as it may cause state to leak '\ 'between tests. If you are using `rspec-rails`, and '\ '`use_transactional_fixtures` is enabled, then records created '\ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb index ec51d2c85349ffd6e518d6dea9b4eceea7bde19b..9f4f1fd517592a540cd997a81aa405f366f76fad 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb @@ -23,7 +23,7 @@ module RuboCop # expect(page).to have_current_path("/callback") # expect(page).to have_current_path(/widgets/) # - class CurrentPathExpectation < Cop + class CurrentPathExpectation < Base extend AutoCorrector MSG = 'Do not set an RSpec expectation on `current_path` in ' \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb index c8e837420cea6ccfbbec829cf7947d95bae525b5..5ff784806fa9f976300ce6bd7fa149ae556e20b1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb @@ -40,7 +40,7 @@ module RuboCop # # ... # end # end - class FeatureMethods < Cop + class FeatureMethods < Base extend AutoCorrector MSG = 'Use `%<replacement>s` instead of `%<method>s`.' @@ -55,15 +55,18 @@ module RuboCop feature: :describe }.freeze + def_node_matcher :capybara_speak, + SelectorSet.new(MAP.keys).node_pattern_union + def_node_matcher :spec?, <<-PATTERN (block - (send #{RSPEC} {:describe :feature} ...) + (send #rspec? {:describe :feature} ...) ...) PATTERN def_node_matcher :feature_method, <<-PATTERN (block - $(send #{RSPEC} ${#{MAP.keys.map(&:inspect).join(' ')}} ...) + $(send #rspec? $#capybara_speak ...) ...) PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb index 4e23c12c9c0c093ee7f37c5b4d13fbf7b681faf0..49d267c9a1df2a2cf59070da4ad926039db21a7d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb @@ -26,7 +26,7 @@ module RuboCop # expect(page).to have_css('.foo', visible: :all) # expect(page).to have_link('my link', visible: :hidden) # - class VisibilityMatcher < Cop + class VisibilityMatcher < Base MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.' MSG_TRUE = 'Use `:visible` instead of `true`.' CAPYBARA_MATCHER_METHODS = %i[ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_method.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_method.rb index 82394723655bc574d12229980eaba0c7373ed92a..ac5a719b341edcfe2547223f502c6a3414fe1ece 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_method.rb @@ -23,13 +23,13 @@ module RuboCop # describe '.foo_bar' do # # ... # end - class ContextMethod < Cop + class ContextMethod < Base extend AutoCorrector MSG = 'Use `describe` for testing methods.' def_node_matcher :context_method, <<-PATTERN - (block (send #{RSPEC} :context $(str #method_name?) ...) ...) + (block (send #rspec? :context $(str #method_name?) ...) ...) PATTERN def on_block(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_wording.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_wording.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_wording.rb index 285cf263a0078127ac37a5cb5bb044f099ff3be5..346a571f449eaaf1b51359030f1acbacb53d96b3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/context_wording.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/context_wording.rb @@ -34,11 +34,11 @@ module RuboCop # context 'when the display name is not present' do # # ... # end - class ContextWording < Cop + class ContextWording < Base MSG = 'Start context description with %<prefixes>s.' def_node_matcher :context_wording, <<-PATTERN - (block (send #{RSPEC} { :context :shared_context } $(str #bad_prefix?) ...) ...) + (block (send #rspec? { :context :shared_context } $(str #bad_prefix?) ...) ...) PATTERN def on_block(node) @@ -51,7 +51,7 @@ module RuboCop private def bad_prefix?(description) - !prefixes.include?(description.split.first) + !prefixes.include?(description.split(/\b/).first) end def joined_prefixes diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/cop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/cop.rb new file mode 100644 index 0000000000000000000000000000000000000000..0571039518bbcf6868c2650c9bcef26131ab6e8b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/cop.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # @deprecated Use ::RuboCop::Cop::RSpec::Base instead + Cop = Base + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_class.rb new file mode 100644 index 0000000000000000000000000000000000000000..2f0bc17e3780a62bbf5e697450676f744703ec96 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_class.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Check that the first argument to the top-level describe is a constant. + # + # @example + # # bad + # describe 'Do something' do + # end + # + # # good + # describe TestedClass do + # subject { described_class } + # end + # + # describe 'TestedClass::VERSION' do + # subject { Object.const_get(self.class.description) } + # end + # + # describe "A feature example", type: :feature do + # end + class DescribeClass < Base + include RuboCop::RSpec::TopLevelGroup + + MSG = 'The first argument to describe should be '\ + 'the class or module being tested.' + + def_node_matcher :rails_metadata?, <<-PATTERN + (pair + (sym :type) + (sym { :channel :controller :helper :job :mailer :model :request + :routing :view :feature :system :mailbox }) + ) + PATTERN + + def_node_matcher :example_group_with_rails_metadata?, <<~PATTERN + (send #rspec? :describe ... (hash <#rails_metadata? ...>)) + PATTERN + + def_node_matcher :not_a_const_described, <<~PATTERN + (send #rspec? :describe $[!const !#string_constant?] ...) + PATTERN + + def on_top_level_group(top_level_node) + return if example_group_with_rails_metadata?(top_level_node.send_node) + + not_a_const_described(top_level_node.send_node) do |described| + add_offense(described) + end + end + + private + + def string_constant?(described) + described.str_type? && + described.value.match?(/^(?:(?:::)?[A-Z]\w*)+$/) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_method.rb similarity index 54% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_method.rb index 7a32739e9c3a0d8b3165f5c48db798299793d4c1..cfc1e814837dfa8dc8b607c4c23d075e5d9f8123 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_method.rb @@ -16,17 +16,25 @@ module RuboCop # # describe MyClass, '.my_class_method' do # end - class DescribeMethod < Cop - include RuboCop::RSpec::TopLevelDescribe + class DescribeMethod < Base + include RuboCop::RSpec::TopLevelGroup MSG = 'The second argument to describe should be the method '\ "being tested. '#instance' or '.class'." - def on_top_level_describe(_node, (_, second_arg)) - return unless second_arg&.str_type? - return if second_arg.str_content.start_with?('#', '.') + def_node_matcher :second_argument, <<~PATTERN + (block + (send #rspec? :describe _first_argument $(str _) ...) ... + ) + PATTERN - add_offense(second_arg) + def on_top_level_group(node) + second_argument = second_argument(node) + + return unless second_argument + return if second_argument.str_content.start_with?('#', '.') + + add_offense(second_argument) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_symbol.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_symbol.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_symbol.rb index 4bffa63fe223ae65705db5ad8ed9aec4d7ea8406..bf8c9ac258681fb07acffa4c9d7c6427b7a2469b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/describe_symbol.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/describe_symbol.rb @@ -17,11 +17,11 @@ module RuboCop # end # # @see https://github.com/rspec/rspec-core/issues/1610 - class DescribeSymbol < Cop + class DescribeSymbol < Base MSG = 'Avoid describing symbols.' def_node_matcher :describe_symbol?, <<-PATTERN - (send #{RSPEC} :describe $sym ...) + (send #rspec? :describe $sym ...) PATTERN def on_send(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class.rb index 222b8f9dbdf163cc82d557d842498e9360800b34..6f4e945d0705ec62fd99ad1b8404514fe4441184 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class.rb @@ -54,7 +54,7 @@ module RuboCop # end # end # - class DescribedClass < Cop + class DescribedClass < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -142,7 +142,7 @@ module RuboCop if style == :described_class offensive_described_class?(node) else - node.send_type? && node.method_name == :described_class + node.send_type? && node.method?(:described_class) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb index e1d548ce59440ebe1601d3e0d081e8b6bfeab36f..b5b9c867e519440c4729ad8cd57c72833b140a16 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb @@ -19,7 +19,7 @@ module RuboCop # end # # @see https://github.com/rubocop-hq/rubocop-rspec/issues/735 - class DescribedClassModuleWrapping < Cop + class DescribedClassModuleWrapping < Base MSG = 'Avoid opening modules and defining specs within them.' def_node_search :find_rspec_blocks, diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/dialect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/dialect.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/dialect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/dialect.rb index 1ad00ff9fe6d842827dd3b214b80e8d814cabf39..d952d6958cabf41887d8c83cf380db9fc8ea6e08 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/dialect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/dialect.rb @@ -41,7 +41,7 @@ module RuboCop # describe 'display name presence' do # # ... # end - class Dialect < Cop + class Dialect < Base extend AutoCorrector include MethodPreference diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_example_group.rb new file mode 100644 index 0000000000000000000000000000000000000000..7eb95b5ff9ad54ae9c764c0cebb15fc65361aa98 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_example_group.rb @@ -0,0 +1,174 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Checks if an example group does not include any tests. + # + # This cop is configurable using the `CustomIncludeMethods` option + # + # @example usage + # + # # bad + # describe Bacon do + # let(:bacon) { Bacon.new(chunkiness) } + # let(:chunkiness) { false } + # + # context 'extra chunky' do # flagged by rubocop + # let(:chunkiness) { true } + # end + # + # it 'is chunky' do + # expect(bacon.chunky?).to be_truthy + # end + # end + # + # # good + # describe Bacon do + # let(:bacon) { Bacon.new(chunkiness) } + # let(:chunkiness) { false } + # + # it 'is chunky' do + # expect(bacon.chunky?).to be_truthy + # end + # end + # + # @example configuration + # + # # .rubocop.yml + # # RSpec/EmptyExampleGroup: + # # CustomIncludeMethods: + # # - include_tests + # + # # spec_helper.rb + # RSpec.configure do |config| + # config.alias_it_behaves_like_to(:include_tests) + # end + # + # # bacon_spec.rb + # describe Bacon do + # let(:bacon) { Bacon.new(chunkiness) } + # let(:chunkiness) { false } + # + # context 'extra chunky' do # not flagged by rubocop + # let(:chunkiness) { true } + # + # include_tests 'shared tests' + # end + # end + # + class EmptyExampleGroup < Base + MSG = 'Empty example group detected.' + + # @!method example_group_body(node) + # Match example group blocks and yield their body + # + # @example source that matches + # describe 'example group' do + # it { is_expected.to be } + # end + # + # @param node [RuboCop::AST::Node] + # @yield [RuboCop::AST::Node] example group body + def_node_matcher :example_group_body, <<~PATTERN + (block #{ExampleGroups::ALL.send_pattern} args $_) + PATTERN + + # @!method example_or_group_or_include?(node) + # Match examples, example groups and includes + # + # @example source that matches + # it { is_expected.to fly } + # describe('non-empty example groups too') { } + # it_behaves_like 'an animal' + # it_behaves_like('a cat') { let(:food) { 'milk' } } + # it_has_root_access + # + # @param node [RuboCop::AST::Node] + # @return [Array<RuboCop::AST::Node>] matching nodes + def_node_matcher :example_or_group_or_include?, <<~PATTERN + { + #{Examples::ALL.block_pattern} + #{ExampleGroups::ALL.block_pattern} + #{Includes::ALL.send_pattern} + #{Includes::ALL.block_pattern} + (send nil? #custom_include? ...) + } + PATTERN + + # @!method examples_inside_block?(node) + # Match examples defined inside a block which is not a hook + # + # @example source that matches + # %w(r g b).each do |color| + # it { is_expected.to have_color(color) } + # end + # + # @example source that does not match + # before do + # it { is_expected.to fall_into_oblivion } + # end + # + # @param node [RuboCop::AST::Node] + # @return [Array<RuboCop::AST::Node>] matching nodes + def_node_matcher :examples_inside_block?, <<~PATTERN + (block !#{Hooks::ALL.send_pattern} _ #examples?) + PATTERN + + # @!method examples_directly_or_in_block?(node) + # Match examples or examples inside blocks + # + # @example source that matches + # it { expect(drink).to be_cold } + # context('when winter') { it { expect(drink).to be_hot } } + # (1..5).each { |divisor| it { is_expected.to divide_by(divisor) } } + # + # @param node [RuboCop::AST::Node] + # @return [Array<RuboCop::AST::Node>] matching nodes + def_node_matcher :examples_directly_or_in_block?, <<~PATTERN + { + #example_or_group_or_include? + #examples_inside_block? + } + PATTERN + + # @!method examples?(node) + # Matches examples defined in scopes where they could run + # + # @example source that matches + # it { expect(myself).to be_run } + # describe { it { i_run_as_well } } + # + # @example source that does not match + # before { it { whatever here wont run anyway } } + # + # @param node [RuboCop::AST::Node] + # @return [Array<RuboCop::AST::Node>] matching nodes + def_node_matcher :examples?, <<~PATTERN + { + #examples_directly_or_in_block? + (begin <#examples_directly_or_in_block? ...>) + } + PATTERN + + def on_block(node) + example_group_body(node) do |body| + add_offense(node.send_node) unless examples?(body) + end + end + + private + + def custom_include?(method_name) + custom_include_methods.include?(method_name) + end + + def custom_include_methods + cop_config + .fetch('CustomIncludeMethods', []) + .map(&:to_sym) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_hook.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_hook.rb index 4e62cd95fadcfc6bfd9ae4cca6552d4fbddf74cb..e272a7bb214e0e47dcceef1c08cd801cf3176542 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_hook.rb @@ -22,7 +22,7 @@ module RuboCop # create_feed # end # after(:all) { cleanup_feed } - class EmptyHook < Cop + class EmptyHook < Base extend AutoCorrector include RuboCop::Cop::RangeHelp diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example.rb index fb8287470c1533d774e09b5b8aa619d67995914b..e0d78373913f76674995c697b52e86f91a494d8d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example.rb @@ -41,22 +41,18 @@ module RuboCop # it { two } # end # - class EmptyLineAfterExample < Cop + class EmptyLineAfterExample < Base extend AutoCorrector - include RuboCop::RSpec::BlankLineSeparation + include RuboCop::RSpec::EmptyLineSeparation MSG = 'Add an empty line after `%<example>s`.' def on_block(node) return unless example?(node) - return if last_child?(node) return if allowed_one_liner?(node) - missing_separating_line(node) do |location| - msg = format(MSG, example: node.method_name) - add_offense(location, message: msg) do |corrector| - corrector.insert_after(location.end, "\n") - end + missing_separating_line_offense(node) do |method| + format(MSG, example: method) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb similarity index 65% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb index 5fe23fc547f7216c1a5902ebeae5796361a13c1d..e02fb73ba11d5cb9b6c47dd82028e1db92f48d62 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb @@ -23,21 +23,17 @@ module RuboCop # end # end # - class EmptyLineAfterExampleGroup < Cop + class EmptyLineAfterExampleGroup < Base extend AutoCorrector - include RuboCop::RSpec::BlankLineSeparation + include RuboCop::RSpec::EmptyLineSeparation MSG = 'Add an empty line after `%<example_group>s`.' def on_block(node) return unless example_group?(node) - return if last_child?(node) - missing_separating_line(node) do |location| - msg = format(MSG, example_group: node.method_name) - add_offense(location, message: msg) do |corrector| - corrector.insert_after(location.end, "\n") - end + missing_separating_line_offense(node) do |method| + format(MSG, example_group: method) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb similarity index 53% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb index 04a9537efd8360b4290b2d19a725d5a8aedbcae8..9bfc56391d24ddf68edf51e9893205638588d75a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb @@ -16,24 +16,21 @@ module RuboCop # let(:something) { other } # # it { does_something } - class EmptyLineAfterFinalLet < Cop + class EmptyLineAfterFinalLet < Base extend AutoCorrector - include RuboCop::RSpec::BlankLineSeparation + include RuboCop::RSpec::EmptyLineSeparation - MSG = 'Add an empty line after the last `let` block.' + MSG = 'Add an empty line after the last `%<let>s`.' def on_block(node) return unless example_group_with_body?(node) - latest_let = node.body.child_nodes.select { |child| let?(child) }.last + final_let = node.body.child_nodes.reverse.find { |child| let?(child) } - return if latest_let.nil? - return if last_child?(latest_let) + return if final_let.nil? - missing_separating_line(latest_let) do |location| - add_offense(location) do |corrector| - corrector.insert_after(location.end, "\n") - end + missing_separating_line_offense(final_let) do |method| + format(MSG, let: method) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb index 1b5f4988192610cf55b8201ff6ee44b261ea4f6b..4728ffdcb7200c108f9b4606a86f49dd14d946de 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb @@ -33,21 +33,17 @@ module RuboCop # # it { does_something } # - class EmptyLineAfterHook < Cop + class EmptyLineAfterHook < Base extend AutoCorrector - include RuboCop::RSpec::BlankLineSeparation + include RuboCop::RSpec::EmptyLineSeparation MSG = 'Add an empty line after `%<hook>s`.' def on_block(node) return unless hook?(node) - return if last_child?(node) - missing_separating_line(node) do |location| - msg = format(MSG, hook: node.method_name) - add_offense(location, message: msg) do |corrector| - corrector.insert_after(location.end, "\n") - end + missing_separating_line_offense(node) do |method| + format(MSG, hook: method) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb index 2b95671fa96fe92191be8555ebd5f64a39ada0dc..bed4d1606e9f0a5c760b8f424402ab467155ab56 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb @@ -14,20 +14,17 @@ module RuboCop # subject(:obj) { described_class } # # let(:foo) { bar } - class EmptyLineAfterSubject < Cop + class EmptyLineAfterSubject < Base extend AutoCorrector - include RuboCop::RSpec::BlankLineSeparation + include RuboCop::RSpec::EmptyLineSeparation - MSG = 'Add empty line after `subject`.' + MSG = 'Add an empty line after `%<subject>s`.' def on_block(node) return unless subject?(node) && !in_spec_block?(node) - return if last_child?(node) - missing_separating_line(node) do |location| - add_offense(location) do |corrector| - corrector.insert_after(location.end, "\n") - end + missing_separating_line_offense(node) do |method| + format(MSG, subject: method) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_length.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_length.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_length.rb index 1bfb2dde33306f53c542d824199765a213fe20c9..35a7142d70264e7ebcc359e98a0063737ddaf23b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_length.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_length.rb @@ -25,7 +25,7 @@ module RuboCop # result = service.call # expect(result).to be(true) # end - class ExampleLength < Cop + class ExampleLength < Base include CodeLength MSG = 'Example has too many lines [%<total>d/%<max>d].' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_without_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_without_description.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_without_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_without_description.rb index 8d4ace983fbf162a3b7605bea11121f0c45e1bd2..f503a8372131f77f704e8e3da80445f67dbfa416 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_without_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_without_description.rb @@ -47,7 +47,7 @@ module RuboCop # result = service.call # expect(result).to be(true) # end - class ExampleWithoutDescription < Cop + class ExampleWithoutDescription < Base include ConfigurableEnforcedStyle MSG_DEFAULT_ARGUMENT = 'Omit the argument when you want to ' \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_wording.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_wording.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_wording.rb index bef638e1d735351dbf084d935b29383b3fdccbac..9232ee69671133dfecab1c18d5de15da83eee021 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/example_wording.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/example_wording.rb @@ -29,7 +29,7 @@ module RuboCop # # good # it 'does things' do # end - class ExampleWording < Cop + class ExampleWording < Base extend AutoCorrector MSG_SHOULD = 'Do not use should when describing your tests.' @@ -47,9 +47,9 @@ module RuboCop def on_block(node) it_description(node) do |description_node, message| - if message =~ SHOULD_PREFIX + if message.match?(SHOULD_PREFIX) add_wording_offense(description_node, MSG_SHOULD) - elsif message =~ IT_PREFIX + elsif message.match?(IT_PREFIX) add_wording_offense(description_node, MSG_IT) end end @@ -77,7 +77,7 @@ module RuboCop def replacement_text(node) text = text(node) - if text =~ SHOULD_PREFIX + if text.match?(SHOULD_PREFIX) RuboCop::RSpec::Wording.new( text, ignore: ignored_words, diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_actual.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_actual.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_actual.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_actual.rb index d01b28a46367b0ed1aba6c245a67b85f2a602078..2b897ad8e638983fe36f826036a74be0a5009378 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_actual.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_actual.rb @@ -16,7 +16,7 @@ module RuboCop # expect(pattern).to eq(/foo/) # expect(name).to eq("John") # - class ExpectActual < Cop + class ExpectActual < Base extend AutoCorrector MSG = 'Provide the actual you are testing to `expect(...)`.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_change.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_change.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_change.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_change.rb index 7687f9cbaf5b9acb14edaf91ca8da4c225f86527..7b2c6b3df3c88553df6f5c5634953f0996ac08bf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_change.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_change.rb @@ -29,7 +29,7 @@ module RuboCop # expect { run }.to change { Foo.bar(:count) } # expect { run }.to change { user.reload.name } # - class ExpectChange < Cop + class ExpectChange < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_in_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_in_hook.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_in_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_in_hook.rb index 8bf284ac0a40eb3a9caf847f6fcad7e40e2dd8d8..79f7c929c7ce8631bc3d64d8f85e0c957c6d11be 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_in_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_in_hook.rb @@ -20,7 +20,7 @@ module RuboCop # it do # expect(something).to eq 'foo' # end - class ExpectInHook < Cop + class ExpectInHook < Base MSG = 'Do not use `%<expect>s` in `%<hook>s` hook' def_node_search :expectation, Expectations::ALL.send_pattern diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_output.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_output.rb index 92ec20216758555c72961622fe2a9965299ce029..6c8c9293826b940453b5598bcd76690820f94419 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/expect_output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/expect_output.rb @@ -14,7 +14,7 @@ module RuboCop # # # good # expect { my_app.print_report }.to output('Hello World').to_stdout - class ExpectOutput < Cop + class ExpectOutput < Base MSG = 'Use `expect { ... }.to output(...).to_%<name>s` '\ 'instead of mutating $%<name>s.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb index 23afbd8b33b4d7c7e7d6b44c08e23287ebe919ac..e78071241b42cdd543e8ab743758c2b2388f83a7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb @@ -24,7 +24,7 @@ module RuboCop # # # good # count { 1 } - class AttributeDefinedStatically < Cop + class AttributeDefinedStatically < Base extend AutoCorrector MSG = 'Use a block to declare attribute values.' @@ -39,7 +39,7 @@ module RuboCop def on_block(node) attributes = factory_attributes(node) || [] - attributes = [attributes] unless attributes.is_a?(Array) + attributes = [attributes] unless attributes.is_a?(Array) # rubocop:disable Style/ArrayCoercion, Lint/RedundantCopDisableDirective attributes.each do |attribute| next unless offensive_receiver?(attribute.receiver, node) @@ -84,7 +84,7 @@ module RuboCop def autocorrect_replacing_parens(corrector, node) left_braces, right_braces = braces(node) - corrector.replace(node.location.begin, ' ' + left_braces) + corrector.replace(node.location.begin, " #{left_braces}") corrector.replace(node.location.end, right_braces) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb index 1c84d431225e0c7e4948dfb81ee9697508429add..4a71a767e1013811cd9a2cb4add2b9975b3a83fe 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb @@ -24,7 +24,7 @@ module RuboCop # # # good # 3.times { create :user } - class CreateList < Cop + class CreateList < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -44,7 +44,7 @@ module RuboCop PATTERN def_node_matcher :factory_list_call, <<-PATTERN - (send ${(const nil? {:FactoryGirl :FactoryBot}) nil?} :create_list (sym $_) (int $_) $...) + (send {(const nil? {:FactoryGirl :FactoryBot}) nil?} :create_list (sym _) (int $_) ...) PATTERN def on_block(node) @@ -60,7 +60,7 @@ module RuboCop def on_send(node) return unless style == :n_times - factory_list_call(node) do |_receiver, _factory, count, _| + factory_list_call(node) do |count| message = format(MSG_N_TIMES, number: count) add_offense(node.loc.selector, message: message) do |corrector| TimesCorrector.new(node).call(corrector) @@ -79,7 +79,7 @@ module RuboCop end # :nodoc - class Corrector + module Corrector private def build_options_string(options) @@ -102,7 +102,9 @@ module RuboCop end # :nodoc - class TimesCorrector < Corrector + class TimesCorrector + include Corrector + def initialize(node) @node = node end @@ -130,7 +132,9 @@ module RuboCop end # :nodoc: - class CreateListCorrector < Corrector + class CreateListCorrector + include Corrector + def initialize(node) @node = node.parent end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb index da2e9672841a7d08fcf44bb1d458caa2395acaed..fb4081218d77d4d895ccf033951e295c3408f8a2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb @@ -19,7 +19,7 @@ module RuboCop # # good # factory :foo, class: 'Foo' do # end - class FactoryClassName < Cop + class FactoryClassName < Base extend AutoCorrector MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/file_path.rb similarity index 79% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/file_path.rb index 4407c871be73aec52379306ef7116172801a80e9..c67c73faf8dcb44f7e5258d97b8b7704bc800a74 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/file_path.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/file_path.rb @@ -56,35 +56,43 @@ module RuboCop # # good # my_class_spec.rb # describe MyClass, '#method' # - class FilePath < Cop - include RuboCop::RSpec::TopLevelDescribe + class FilePath < Base + include RuboCop::RSpec::TopLevelGroup MSG = 'Spec path should end with `%<suffix>s`.' - def_node_search :const_described?, '(send _ :describe (const ...) ...)' + def_node_matcher :const_described, <<~PATTERN + (block + $(send #rspec? _example_group $(const ...) $...) ... + ) + PATTERN + def_node_search :routing_metadata?, '(pair (sym :type) (sym :routing))' - def on_top_level_describe(node, args) - return unless const_described?(node) && single_top_level_describe? - return if routing_spec?(args) + def on_top_level_group(node) + return unless top_level_groups.one? - glob = glob_for(args) + const_described(node) do |send_node, described_class, arguments| + next if routing_spec?(arguments) - return if filename_ends_with?(glob) - - add_offense( - node, - message: format(MSG, suffix: glob) - ) + ensure_correct_file_path(send_node, described_class, arguments) + end end private + def ensure_correct_file_path(send_node, described_class, arguments) + glob = glob_for(described_class, arguments.first) + return if filename_ends_with?(glob) + + add_offense(send_node, message: format(MSG, suffix: glob)) + end + def routing_spec?(args) args.any?(&method(:routing_metadata?)) end - def glob_for((described_class, method_name)) + def glob_for(described_class, method_name) return glob_for_spec_suffix_only? if spec_suffix_only? "#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb" @@ -94,10 +102,10 @@ module RuboCop '*_spec.rb' end - def name_glob(name) - return unless name&.str_type? + def name_glob(method_name) + return unless method_name&.str_type? - "*#{name.str_content.gsub(/\W/, '')}" unless ignore_methods? + "*#{method_name.str_content.gsub(/\W/, '')}" unless ignore_methods? end def expected_path(constant) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/focus.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/focus.rb similarity index 68% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/focus.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/focus.rb index 11413d4e5f609d0816a22a2efed2eeaf8436769a..d49c77f9effee9e3769990abceb0102054f6dbf9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/focus.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/focus.rb @@ -19,23 +19,19 @@ module RuboCop # # good # describe MyClass do # end - class Focus < Cop + class Focus < Base MSG = 'Focused spec found.' - focusable = - ExampleGroups::GROUPS + - ExampleGroups::SKIPPED + - Examples::EXAMPLES + - Examples::SKIPPED + - Examples::PENDING - focused = ExampleGroups::FOCUSED + Examples::FOCUSED - FOCUSABLE_SELECTORS = focusable.node_pattern_union + def_node_matcher :focusable_selector?, + (ExampleGroups::GROUPS + ExampleGroups::SKIPPED + + Examples::EXAMPLES + Examples::SKIPPED + + Examples::PENDING).node_pattern_union def_node_matcher :metadata, <<-PATTERN - {(send #{RSPEC} #{FOCUSABLE_SELECTORS} <$(sym :focus) ...>) - (send #{RSPEC} #{FOCUSABLE_SELECTORS} ... (hash <$(pair (sym :focus) true) ...>))} + {(send #rspec? #focusable_selector? <$(sym :focus) ...>) + (send #rspec? #focusable_selector? ... (hash <$(pair (sym :focus) true) ...>))} PATTERN def_node_matcher :focused_block?, focused.send_pattern diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hook_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hook_argument.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hook_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hook_argument.rb index f62ba0301aabaeec3a979446214d9572b91c3882..b722c10ab27873c20d933bd6d4f5cd6434636312 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hook_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hook_argument.rb @@ -57,21 +57,20 @@ module RuboCop # before(:example) do # # ... # end - class HookArgument < Cop + class HookArgument < Base extend AutoCorrector include ConfigurableEnforcedStyle - IMPLICIT_MSG = 'Omit the default `%<scope>p` ' \ - 'argument for RSpec hooks.' + IMPLICIT_MSG = 'Omit the default `%<scope>p` argument for RSpec hooks.' EXPLICIT_MSG = 'Use `%<scope>p` for RSpec hooks.' - HOOKS = Hooks::ALL.node_pattern_union.freeze + def_node_matcher :hook?, Hooks::ALL.node_pattern_union def_node_matcher :scoped_hook, <<-PATTERN - (block $(send _ #{HOOKS} (sym ${:each :example})) ...) + (block $(send _ #hook? (sym ${:each :example})) ...) PATTERN - def_node_matcher :unscoped_hook, "(block $(send _ #{HOOKS}) ...)" + def_node_matcher :unscoped_hook, '(block $(send _ #hook?) ...)' def on_block(node) hook(node) do |method_send, scope_name| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hooks_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hooks_before_examples.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hooks_before_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hooks_before_examples.rb index dcaba4ea191b6e195d06fdd48b88b14d9b9c6048..fa9eea0b91766c663841553e0015033ff62d758f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/hooks_before_examples.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/hooks_before_examples.rb @@ -23,7 +23,7 @@ module RuboCop # expect(foo).to be # end # - class HooksBeforeExamples < Cop + class HooksBeforeExamples < Base extend AutoCorrector MSG = 'Move `%<hook>s` above the examples in the group.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb index d77680029a6b2479b1eb67e4b0cf12db6abde9db..6c00f0730e76cb1b047503745be4e1c337031333 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb @@ -16,7 +16,7 @@ module RuboCop # it 'changes something to a new value' do # expect { do_something }.to change(something).to(new_value) # end - class ImplicitBlockExpectation < Cop + class ImplicitBlockExpectation < Base MSG = 'Avoid implicit block expectations.' def_node_matcher :lambda?, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_expect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_expect.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_expect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_expect.rb index d691df2a95c4a9a5808db3f763d22824f6e10380..c08fd877d4b9920f5368c783042cdb25b1d72b75 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_expect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_expect.rb @@ -24,7 +24,7 @@ module RuboCop # # good # it { should be_truthy } # - class ImplicitExpect < Cop + class ImplicitExpect < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_subject.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_subject.rb index 7af5bc299b540de9c2b5c1ce25021bb4c8624c93..ec5c184cca60eab6093088515209e97d08233245 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/implicit_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/implicit_subject.rb @@ -26,7 +26,7 @@ module RuboCop # # good # it { expect(subject).to be_truthy } # - class ImplicitSubject < Cop + class ImplicitSubject < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -49,9 +49,10 @@ module RuboCop def autocorrect(corrector, node) replacement = 'expect(subject)' - if node.method_name == :should + case node.method_name + when :should replacement += '.to' - elsif node.method_name == :should_not + when :should_not replacement += '.not_to' end @@ -62,13 +63,14 @@ module RuboCop example = node.ancestors.find { |parent| example?(parent) } return false if example.nil? - example.method_name == :its || allowed_by_style?(example) + example.method?(:its) || allowed_by_style?(example) end def allowed_by_style?(example) - if style == :single_line_only + case style + when :single_line_only example.single_line? - elsif style == :single_statement_only + when :single_statement_only !example.body.begin_type? else false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_spy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_spy.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_spy.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_spy.rb index 96a2d407bd07dc8e01b0332e0aa4e085cb7f60f5..bda0f2ad9a369b4b9a20e353d48682cc97187a2c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_spy.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_spy.rb @@ -18,7 +18,7 @@ module RuboCop # expect(foo).to have_received(:bar) # end # - class InstanceSpy < Cop + class InstanceSpy < Base extend AutoCorrector MSG = 'Use `instance_spy` when you check your double '\ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_variable.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_variable.rb index 01eee1886f6d42a03e7ee5aecd07e712dbffb422..4e1ad1b6f8eebba53ace6635c6e0cda4e39d53ac 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/instance_variable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/instance_variable.rb @@ -46,7 +46,7 @@ module RuboCop # it { expect(foo).to be_empty } # end # - class InstanceVariable < Cop + class InstanceVariable < Base include RuboCop::RSpec::TopLevelGroup MSG = 'Avoid instance variables 鈥� use let, ' \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb index 011ea0027e2d41867e67423a6412dfc66df81d4e..018b5c9ff4849db27216c90109cee7e9bfac8b24 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb @@ -15,7 +15,7 @@ module RuboCop # # # good # expect(foo).to be_something - class InvalidPredicateMatcher < Cop + class InvalidPredicateMatcher < Base MSG = 'Omit `?` from `%<matcher>s`.' def_node_matcher :invalid_predicate_matcher?, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/it_behaves_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/it_behaves_like.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/it_behaves_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/it_behaves_like.rb index bc219b5736b9bbfba312036586683e1fa9c1b4fb..28bf711233587c5ee623c634982a6bf9500b9210 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/it_behaves_like.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/it_behaves_like.rb @@ -18,7 +18,7 @@ module RuboCop # # # good # it_should_behave_like 'a foo' - class ItBehavesLike < Cop + class ItBehavesLike < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/iterated_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/iterated_expectation.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/iterated_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/iterated_expectation.rb index 0da8ec134616e2140b0be1558208a30f9006a76d..18be6248a9ea9226a93a6df16a2f270ca30405de 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/iterated_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/iterated_expectation.rb @@ -15,7 +15,7 @@ module RuboCop # it 'validates users' do # expect([user1, user2, user3]).to all(be_valid) # end - class IteratedExpectation < Cop + class IteratedExpectation < Base MSG = 'Prefer using the `all` matcher instead ' \ 'of iterating over an array.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leading_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leading_subject.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leading_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leading_subject.rb index 9080e9a776cb007e19c30c7ed317edafa203781f..1789c55b7f2f4721c2b22a12a75311e17984cc46 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leading_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leading_subject.rb @@ -31,7 +31,7 @@ module RuboCop # it { expect_something } # it { expect_something_else } # - class LeadingSubject < Cop + class LeadingSubject < Base extend AutoCorrector MSG = 'Declare `subject` above any other `%<offending>s` declarations.' @@ -43,33 +43,36 @@ module RuboCop end def check_previous_nodes(node) - node.parent.each_child_node do |sibling| - if offending?(sibling) - msg = format(MSG, offending: sibling.method_name) - add_offense(node, message: msg) do |corrector| - autocorrect(corrector, node) - end + offending_node(node) do |offender| + msg = format(MSG, offending: offender.method_name) + add_offense(node, message: msg) do |corrector| + autocorrect(corrector, node, offender) end - - break if offending?(sibling) || sibling.equal?(node) end end private - def autocorrect(corrector, node) - first_node = find_first_offending_node(node) + def offending_node(node) + node.parent.each_child_node.find do |sibling| + break if sibling.equal?(node) + + yield sibling if offending?(sibling) + end + end + + def autocorrect(corrector, node, sibling) RuboCop::RSpec::Corrector::MoveNode.new( node, corrector, processed_source - ).move_before(first_node) + ).move_before(sibling) end def offending?(node) - let?(node) || hook?(node) || example?(node) - end - - def find_first_offending_node(node) - node.parent.children.find { |sibling| offending?(sibling) } + let?(node) || + hook?(node) || + example?(node) || + spec_group?(node) || + include?(node) end def in_spec_block?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb index 6431eefbe5985e92fd4f5802ca870964e1deee15..6f5a932e05b0cce1982276cf87d9851b5194f294 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb @@ -93,7 +93,7 @@ module RuboCop # stub_const('SomeModule::SomeClass', foo_class) # end # end - class LeakyConstantDeclaration < Cop + class LeakyConstantDeclaration < Base MSG_CONST = 'Stub constant instead of declaring explicitly.' MSG_CLASS = 'Stub class constant instead of declaring explicitly.' MSG_MODULE = 'Stub module constant instead of declaring explicitly.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_before_examples.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_before_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_before_examples.rb index 8df74f412f12044ba9c9c24e2b0bb4de60087256..aeacb76fbd77d0dfe5e32a84f90f7b1d124e2c22 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_before_examples.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_before_examples.rb @@ -30,7 +30,7 @@ module RuboCop # it 'checks what some does' do # expect(some).to be # end - class LetBeforeExamples < Cop + class LetBeforeExamples < Base extend AutoCorrector MSG = 'Move `let` before the examples in the group.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_setup.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_setup.rb index eee06dbe4824ff94bb1212a1087d4f92e36bea2f..819ae5e4c7fcbf50baa3618dde7b79646fcb96e6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/let_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/let_setup.rb @@ -25,7 +25,7 @@ module RuboCop # it 'counts widgets' do # expect(Widget.count).to eq(1) # end - class LetSetup < Cop + class LetSetup < Base MSG = 'Do not use `let!` to setup objects not referenced in tests.' def_node_matcher :example_or_shared_group_or_including?, @@ -35,7 +35,10 @@ module RuboCop ).block_pattern def_node_matcher :let_bang, <<-PATTERN - (block $(send nil? :let! (sym $_)) args ...) + { + (block $(send nil? :let! {(sym $_) (str $_)}) ...) + $(send nil? :let! {(sym $_) (str $_)} block_pass) + } PATTERN def_node_search :method_called?, '(send nil? %)' @@ -52,7 +55,7 @@ module RuboCop def unused_let_bang(node) child_let_bang(node) do |method_send, method_name| - yield(method_send) unless method_called?(node, method_name) + yield(method_send) unless method_called?(node, method_name.to_sym) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_chain.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_chain.rb index c3fce664e49f806b7aabc6a7c2874aea2cfd0558..561efc374c19eafefdfb990f9c71054312e3d60b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_chain.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_chain.rb @@ -13,7 +13,7 @@ module RuboCop # thing = Thing.new(baz: 42) # allow(foo).to receive(:bar).and_return(thing) # - class MessageChain < Cop + class MessageChain < Base MSG = 'Avoid stubbing using `%<method>s`.' def_node_matcher :message_chain, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_expectation.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_expectation.rb index 0a6e4e298449f7340a1c9329e0a67e3da7e87fc3..ff0f93b8b2b1a291d033ea443b23eb6838776984 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_expectation.rb @@ -24,7 +24,7 @@ module RuboCop # # good # expect(foo).to receive(:bar) # - class MessageExpectation < Cop + class MessageExpectation < Base include ConfigurableEnforcedStyle MSG = 'Prefer `%<style>s` for setting message expectations.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_spies.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_spies.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_spies.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_spies.rb index 7f9f7fbc6bab4df8eba41c32ea7bca3333c8eccb..e1460d2c035ca7b8b67a0bc6884425b812bb2e27 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/message_spies.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/message_spies.rb @@ -24,7 +24,7 @@ module RuboCop # # good # expect(foo).to receive(:bar) # - class MessageSpies < Cop + class MessageSpies < Base include ConfigurableEnforcedStyle MSG_RECEIVE = 'Prefer `receive` for setting message expectations.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb index b317b65bb1ddba7423e46b05f53a74092ad5cd05..a29df6f591c27ddb8edcdcd2015e2ee3475364c2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb @@ -19,7 +19,7 @@ module RuboCop # # describe "A feature example" do # end - class MissingExampleGroupArgument < Cop + class MissingExampleGroupArgument < Base MSG = 'The first argument to `%<method>s` should not be empty.' def on_block(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_describes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_describes.rb similarity index 56% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_describes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_describes.rb index 79d28cd3fc37c16b97b2e3a928aae11adf3982d4..9ca9fb9ae0ccdfec2e539f28fd5289f925c268ae 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_describes.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_describes.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module RSpec - # Checks for multiple top level describes. + # Checks for multiple top-level example groups. # # Multiple descriptions for the same class or module should either # be nested or separated into different test files. @@ -22,17 +22,20 @@ module RuboCop # describe '.do_something_else' do # end # end - class MultipleDescribes < Cop - include RuboCop::RSpec::TopLevelDescribe + class MultipleDescribes < Base + include RuboCop::RSpec::TopLevelGroup - MSG = 'Do not use multiple top level describes - '\ + MSG = 'Do not use multiple top-level example groups - '\ 'try to nest them.' - def on_top_level_describe(node, _args) - return if single_top_level_describe? - return unless top_level_nodes.first.equal?(node) + def on_top_level_group(node) + top_level_example_groups = + top_level_groups.select(&method(:example_group?)) - add_offense(node) + return if top_level_example_groups.one? + return unless top_level_example_groups.first.equal?(node) + + add_offense(node.send_node) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_expectations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_expectations.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_expectations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_expectations.rb index 2910d5213584026bdb9c45d44563e24b6d2fa943..865e2a696255a733333f984f5443471b77906ce8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_expectations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_expectations.rb @@ -45,22 +45,18 @@ module RuboCop # end # end # - class MultipleExpectations < Cop + class MultipleExpectations < Base include ConfigurableMax MSG = 'Example has too many expectations [%<total>d/%<max>d].' - def_node_matcher :aggregate_failures?, <<-PATTERN - (block { - (send _ _ <(sym :aggregate_failures) ...>) - (send _ _ ... (hash <(pair (sym :aggregate_failures) true) ...>)) - } ...) - PATTERN + ANYTHING = ->(_node) { true } + TRUE = ->(node) { node.true_type? } - def_node_matcher :aggregate_failures_present?, <<-PATTERN + def_node_matcher :aggregate_failures?, <<-PATTERN (block { (send _ _ <(sym :aggregate_failures) ...>) - (send _ _ ... (hash <(pair (sym :aggregate_failures) _) ...>)) + (send _ _ ... (hash <(pair (sym :aggregate_failures) %1) ...>)) } ...) PATTERN @@ -89,12 +85,12 @@ module RuboCop node_with_aggregate_failures = find_aggregate_failures(example_node) return false unless node_with_aggregate_failures - aggregate_failures?(node_with_aggregate_failures) + aggregate_failures?(node_with_aggregate_failures, TRUE) end def find_aggregate_failures(example_node) example_node.send_node.each_ancestor(:block) - .find { |block_node| aggregate_failures_present?(block_node) } + .find { |block_node| aggregate_failures?(block_node, ANYTHING) } end def find_expectation(node, &block) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb new file mode 100644 index 0000000000000000000000000000000000000000..4ad7a0cf2139603874f0004d9930ff8fdb0f5b45 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Checks if example groups contain too many `let` and `subject` calls. + # + # This cop is configurable using the `Max` option and the `AllowSubject` + # which will configure the cop to only register offenses on calls to + # `let` and not calls to `subject`. + # + # @example + # # bad + # describe MyClass do + # let(:foo) { [] } + # let(:bar) { [] } + # let!(:baz) { [] } + # let(:qux) { [] } + # let(:quux) { [] } + # let(:quuz) { {} } + # end + # + # describe MyClass do + # let(:foo) { [] } + # let(:bar) { [] } + # let!(:baz) { [] } + # + # context 'when stuff' do + # let(:qux) { [] } + # let(:quux) { [] } + # let(:quuz) { {} } + # end + # end + # + # # good + # describe MyClass do + # let(:bar) { [] } + # let!(:baz) { [] } + # let(:qux) { [] } + # let(:quux) { [] } + # let(:quuz) { {} } + # end + # + # describe MyClass do + # context 'when stuff' do + # let(:foo) { [] } + # let(:bar) { [] } + # let!(:booger) { [] } + # end + # + # context 'when other stuff' do + # let(:qux) { [] } + # let(:quux) { [] } + # let(:quuz) { {} } + # end + # end + # + # @example when disabling AllowSubject configuration + # + # # rubocop.yml + # # RSpec/MultipleMemoizedHelpers: + # # AllowSubject: false + # + # # bad - `subject` counts towards memoized helpers + # describe MyClass do + # subject { {} } + # let(:foo) { [] } + # let(:bar) { [] } + # let!(:baz) { [] } + # let(:qux) { [] } + # let(:quux) { [] } + # end + # + # @example with Max configuration + # + # # rubocop.yml + # # RSpec/MultipleMemoizedHelpers: + # # Max: 1 + # + # # bad + # describe MyClass do + # let(:foo) { [] } + # let(:bar) { [] } + # end + # + class MultipleMemoizedHelpers < Base + include ConfigurableMax + include RuboCop::RSpec::Variable + + MSG = 'Example group has too many memoized helpers [%<count>d/%<max>d]' + + def on_block(node) + return unless spec_group?(node) + + count = all_helpers(node).uniq.count + + return if count <= max + + self.max = count + add_offense(node, message: format(MSG, count: count, max: max)) + end + + def on_new_investigation + @example_group_memoized_helpers = {} + end + + private + + attr_reader :example_group_memoized_helpers + + def all_helpers(node) + [ + *helpers(node), + *node.each_ancestor(:block).flat_map(&method(:helpers)) + ] + end + + def helpers(node) + @example_group_memoized_helpers[node] ||= + variable_nodes(node).map do |variable_node| + if variable_node.block_type? + variable_definition?(variable_node.send_node) + else # block-pass (`let(:foo, &bar)`) + variable_definition?(variable_node) + end + end + end + + def variable_nodes(node) + example_group = RuboCop::RSpec::ExampleGroup.new(node) + if allow_subject? + example_group.lets + else + example_group.lets + example_group.subjects + end + end + + def max + cop_config['Max'] + end + + def allow_subject? + cop_config['AllowSubject'] + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_subjects.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_subjects.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_subjects.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_subjects.rb index 808d1f256ae4e83f1616ad38292b010ff853b260..1667748a85eed989e213ada80f777ef44b37924a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/multiple_subjects.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/multiple_subjects.rb @@ -33,7 +33,7 @@ module RuboCop # - If subjects are defined with `subject!` then we don't autocorrect. # This is enough of an edge case that people can just move this to # a `before` hook on their own - class MultipleSubjects < Cop + class MultipleSubjects < Base extend AutoCorrector include RangeHelp diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/named_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/named_subject.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/named_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/named_subject.rb index efcbd93ebe8bd325b907e657dfa22ae0f5c09a3c..44d30a7b1753ffc79d23438e7a2ec5226b8ba698 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/named_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/named_subject.rb @@ -41,7 +41,7 @@ module RuboCop # # it { is_expected.to be_valid } # end - class NamedSubject < Cop + class NamedSubject < Base MSG = 'Name your test subject if you need '\ 'to reference it explicitly.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/nested_groups.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/nested_groups.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/nested_groups.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/nested_groups.rb index e626df506192326cd42ad5388a611b60d5185732..44301d789c02f84827a10e5b07066c934a4075ae 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/nested_groups.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/nested_groups.rb @@ -85,9 +85,9 @@ module RuboCop # end # end # - class NestedGroups < Cop + class NestedGroups < Base include ConfigurableMax - include RuboCop::RSpec::TopLevelDescribe + include RuboCop::RSpec::TopLevelGroup MSG = 'Maximum example group nesting exceeded [%<total>d/%<max>d].' @@ -97,8 +97,8 @@ module RuboCop "Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \ 'deprecated in favor of `Max`. Please use that instead.' - def on_top_level_describe(node, _args) - find_nested_example_groups(node.parent) do |example_group, nesting| + def on_top_level_group(node) + find_nested_example_groups(node) do |example_group, nesting| self.max = nesting add_offense( example_group.send_node, diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/not_to_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/not_to_not.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/not_to_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/not_to_not.rb index 726dbc20146d3563465e49edafe2e63aa2f73529..f47e69fa81a999f51495f6871b486f1f37b3b49c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/not_to_not.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/not_to_not.rb @@ -15,7 +15,7 @@ module RuboCop # it '...' do # expect(false).not_to be_true # end - class NotToNot < Cop + class NotToNot < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/overwriting_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/overwriting_setup.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/overwriting_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/overwriting_setup.rb index b43c72e683592120e879dd208c856f9235a5136c..5e0cbe14bd4305a6ada7f10805396a2a5e731970 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/overwriting_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/overwriting_setup.rb @@ -21,7 +21,7 @@ module RuboCop # let(:foo) { bar } # let(:baz) { baz } # let!(:other) { other } - class OverwritingSetup < Cop + class OverwritingSetup < Base MSG = '`%<name>s` is already defined.' def_node_matcher :setup?, (Helpers::ALL + Subject::ALL).block_pattern diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/pending.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/pending.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/pending.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/pending.rb index d48b41bd662ad8b07f68308502c3c5a7a8c47e42..830c18a7a2a79dbf32228319197be9e48524ef34 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/pending.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/pending.rb @@ -31,7 +31,7 @@ module RuboCop # # good # describe MyClass do # end - class Pending < Cop + class Pending < Base MSG = 'Pending spec found.' PENDING = Examples::PENDING + Examples::SKIPPED + ExampleGroups::SKIPPED diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/predicate_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/predicate_matcher.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/predicate_matcher.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/predicate_matcher.rb index 504b72093f5470fc3a283a41625f2ad65b0f4e19..13d1f6fbef2e58fbd9ae720f99e9f3c7b2a99350 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/predicate_matcher.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/predicate_matcher.rb @@ -208,18 +208,20 @@ module RuboCop 'is_a?' when 'be_an_instance_of', 'be_instance_of', 'an_instance_of' 'instance_of?' - when 'include', 'respond_to' - matcher + '?' + when 'include' + 'include?' + when 'respond_to' + 'respond_to?' when /^have_(.+)/ "has_#{Regexp.last_match(1)}?" else - matcher[/^be_(.+)/, 1] + '?' + "#{matcher[/^be_(.+)/, 1]}?" end end # rubocop:enable Metrics/MethodLength def replacement_matcher(node) - case [cop_config['Strict'], node.method_name == :to] + case [cop_config['Strict'], node.method?(:to)] when [true, true] 'be(true)' when [true, false] @@ -269,7 +271,7 @@ module RuboCop # # # good - the above code is rewritten to it by this cop # expect(foo.something?).to be_truthy - class PredicateMatcher < Cop + class PredicateMatcher < Base extend AutoCorrector include ConfigurableEnforcedStyle include InflectedHelper @@ -288,15 +290,6 @@ module RuboCop check_explicit(node) if style == :explicit end - def autocorrect(node) - case style - when :inflected - autocorrect_inflected(node) - when :explicit - autocorrect_explicit(node) - end - end - private # returns args location with whitespace diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/rails/http_status.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/rails/http_status.rb index 342675b5499aa099a1cffe50e656be860ce20746..8dc27c2175b14c0b3b324ae177d7263941d26ec1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/rails/http_status.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/rails/http_status.rb @@ -30,7 +30,7 @@ module RuboCop # it { is_expected.to have_http_status :success } # it { is_expected.to have_http_status :error } # - class HttpStatus < Cop + class HttpStatus < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_counts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_counts.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_counts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_counts.rb index c806a3431c4e882521596a3091580aafa27e6844..4a89b729968c1e93c9002a3768c4939c36c3897b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_counts.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_counts.rb @@ -23,7 +23,7 @@ module RuboCop # expect(foo).to receive(:bar).at_most(:once) # expect(foo).to receive(:bar).at_most(:twice).times # - class ReceiveCounts < Cop + class ReceiveCounts < Base extend AutoCorrector MSG = 'Use `%<alternative>s` instead of `%<original>s`.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_never.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_never.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_never.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_never.rb index 109cca7b95afd198081aaf21810658b95d95c326..840360cfffd25e0becd902968391c02411efddb5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/receive_never.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/receive_never.rb @@ -13,14 +13,14 @@ module RuboCop # # good # expect(foo).not_to receive(:bar) # - class ReceiveNever < Cop + class ReceiveNever < Base extend AutoCorrector MSG = 'Use `not_to receive` instead of `never`.' def_node_search :method_on_stub?, '(send nil? :receive ...)' def on_send(node) - return unless node.method_name == :never && method_on_stub?(node) + return unless node.method?(:never) && method_on_stub?(node) add_offense(node.loc.selector) do |corrector| autocorrect(corrector, node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_description.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_description.rb index 36b79973b11673231c4896f9b174ff2c52014b12..f499bb102337ae61b453b0ae75cfacb0a9f95909 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_description.rb @@ -40,7 +40,7 @@ module RuboCop # end # end # - class RepeatedDescription < Cop + class RepeatedDescription < Base MSG = "Don't repeat descriptions within an example group." def on_block(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example.rb index 9dce0ea1573dc4c3bfcb2bcea9351bc211e41c21..7a7274aade20b02df0859153930a7241f9166390 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example.rb @@ -15,7 +15,7 @@ module RuboCop # expect(user).to be_valid # end # - class RepeatedExample < Cop + class RepeatedExample < Base MSG = "Don't repeat examples within an example group." def on_block(node) @@ -41,7 +41,7 @@ module RuboCop def example_signature(example) key_parts = [example.metadata, example.implementation] - if example.definition.method_name == :its + if example.definition.method?(:its) key_parts << example.definition.arguments end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_body.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_body.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb index 0670df5545b949a2b4ba31988b3ffac6566428cb..cfa1f78a7dea4c9c39335f8725608bfce9fd1f1e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_body.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb @@ -43,7 +43,7 @@ module RuboCop # it { is_expected.to respond_to :each } # end # - class RepeatedExampleGroupBody < Cop + class RepeatedExampleGroupBody < Base MSG = 'Repeated %<group>s block body on line(s) %<loc>s' def_node_matcher :several_example_groups?, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb index 17da2b5cf63d218837f668f0b843492e15bdb464..2545c26f74c969333bf24c273f3ab1db7ce68669 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/repeated_example_group_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb @@ -43,7 +43,7 @@ module RuboCop # # example group # end # - class RepeatedExampleGroupDescription < Cop + class RepeatedExampleGroupDescription < Base MSG = 'Repeated %<group>s block description on line(s) %<loc>s' def_node_matcher :several_example_groups?, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/return_from_stub.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/return_from_stub.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/return_from_stub.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/return_from_stub.rb index 6484232edf24f62ef0d472fa42fd961e1bb55aea..0cce32ed904763efcb7bef501e95c46dc4620caf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/return_from_stub.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/return_from_stub.rb @@ -33,7 +33,7 @@ module RuboCop # # also good as the returned value is dynamic # allow(Foo).to receive(:bar) { bar.baz } # - class ReturnFromStub < Cop + class ReturnFromStub < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_let.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_let.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_let.rb index 02426458afd5ab7eeaeb6e4733fc777fad3c07f6..8644b81e0912c65cfef1d44b25b16dc7e411e155 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_let.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_let.rb @@ -26,7 +26,7 @@ module RuboCop # let!(:baz) { 3 } # end # - class ScatteredLet < Cop + class ScatteredLet < Base extend AutoCorrector MSG = 'Group all let/let! blocks in the example group together.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_setup.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_setup.rb index f54a0a482e6712bfa6b1e02674ecc167b2b012f4..90eea5f2409eaa34b61e2992dc625a602f7f9e14 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/scattered_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/scattered_setup.rb @@ -22,7 +22,7 @@ module RuboCop # end # end # - class ScatteredSetup < Cop + class ScatteredSetup < Base MSG = 'Do not define multiple `%<hook_name>s` hooks in the same '\ 'example group (also defined on %<lines>s).' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_context.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_context.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_context.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_context.rb index 6316ef25ec5a58763e1f21a283ab86f8e2fe4791..34a9088885c03caa1fc94166d8cc16878ff8e24d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_context.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_context.rb @@ -50,7 +50,7 @@ module RuboCop # end # end # - class SharedContext < Cop + class SharedContext < Base extend AutoCorrector MSG_EXAMPLES = "Use `shared_examples` when you don't "\ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_examples.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_examples.rb index eea12d7c78e90d2fae01d8a3fdb5b4b4d5c323dd..10732d30cba619563d6f334a39ac09fe2b6a3dc5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/shared_examples.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/shared_examples.rb @@ -20,7 +20,7 @@ module RuboCop # shared_examples_for 'foo bar baz' # include_examples 'foo bar baz' # - class SharedExamples < Cop + class SharedExamples < Base extend AutoCorrector def_node_matcher :shared_examples, diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb index b8c8a725b7ac97e39721e249c286e91da387e5be..77e8aef273ff9db8967f62f9ee127df64b8e18d3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb @@ -16,7 +16,7 @@ module RuboCop # allow(foo).to receive(:bar, :baz) # allow(foo).to receive("bar.baz") # - class SingleArgumentMessageChain < Cop + class SingleArgumentMessageChain < Base extend AutoCorrector MSG = 'Use `%<recommended>s` instead of calling '\ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/subject_stub.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/subject_stub.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/subject_stub.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/subject_stub.rb index f51e419a0efb882b08c5db0b56cf10740f0526ae..529b1f0eaabbae3eda33baf866a3940081157411 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/subject_stub.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/subject_stub.rb @@ -21,7 +21,7 @@ module RuboCop # end # end # - class SubjectStub < Cop + class SubjectStub < Base include RuboCop::RSpec::TopLevelGroup MSG = 'Do not stub methods of the object under test.' @@ -39,7 +39,7 @@ module RuboCop # name # => :thing # end # - # @param node [RuboCop::Node] + # @param node [RuboCop::AST::Node] # # @yield [Symbol] subject name def_node_matcher :subject, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/unspecified_exception.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/unspecified_exception.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/unspecified_exception.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/unspecified_exception.rb index 893264f8a8f1f3f4ca040c9cf174459ccf4b5477..04092f20a8bbfbebd7b66231802aebfda4151d3a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/unspecified_exception.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/unspecified_exception.rb @@ -30,7 +30,7 @@ module RuboCop # }.to raise_error(/err/) # # expect { do_something }.not_to raise_error - class UnspecifiedException < Cop + class UnspecifiedException < Base MSG = 'Specify the exception being captured' def_node_matcher :empty_raise_error_or_exception, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_definition.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_definition.rb index 5981d07e4f566a9bb2ec68fe662fdd3a6d5653fc..91485d3f3854b8990247080d4ac0539a5994d4f7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/variable_definition.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_definition.rb @@ -7,22 +7,22 @@ module RuboCop # # @example EnforcedStyle: symbols (default) # # bad - # let('user_name') { 'Adam' } # subject('user') { create_user } + # let('user_name') { 'Adam' } # # # good - # let(:user_name) { 'Adam' } # subject(:user) { create_user } + # let(:user_name) { 'Adam' } # # @example EnforcedStyle: strings # # bad - # let(:user_name) { 'Adam' } # subject(:user) { create_user } + # let(:user_name) { 'Adam' } # # # good - # let('user_name') { 'Adam' } # subject('user') { create_user } - class VariableDefinition < Cop + # let('user_name') { 'Adam' } + class VariableDefinition < Base include ConfigurableEnforcedStyle include RuboCop::RSpec::Variable @@ -44,7 +44,7 @@ module RuboCop end def string?(node) - node.str_type? || node.dstr_type? + node.str_type? end def symbol?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_name.rb new file mode 100644 index 0000000000000000000000000000000000000000..92600f2e9928b7a11426e72ee3c262134db39f0e --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/variable_name.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Checks that memoized helper names use the configured style. + # + # Variables can be excluded from checking using the `IgnoredPatterns` + # option. + # + # @example EnforcedStyle: snake_case (default) + # # bad + # subject(:userName1) { 'Adam' } + # let(:userName2) { 'Adam' } + # + # # good + # subject(:user_name_1) { 'Adam' } + # let(:user_name_2) { 'Adam' } + # + # @example EnforcedStyle: camelCase + # # bad + # subject(:user_name_1) { 'Adam' } + # let(:user_name_2) { 'Adam' } + # + # # good + # subject(:userName1) { 'Adam' } + # let(:userName2) { 'Adam' } + # + # @example IgnoredPatterns configuration + # + # # rubocop.yml + # # RSpec/VariableName: + # # EnforcedStyle: snake_case + # # IgnoredPatterns: + # # - ^userFood + # + # @example + # # okay because it matches the `^userFood` regex in `IgnoredPatterns` + # subject(:userFood_1) { 'spaghetti' } + # let(:userFood_2) { 'fettuccine' } + # + class VariableName < Base + include ConfigurableNaming + include IgnoredPattern + include RuboCop::RSpec::Variable + + MSG = 'Use %<style>s for variable names.' + + def on_send(node) + variable_definition?(node) do |variable| + return if variable.dstr_type? || variable.dsym_type? + return if matches_ignored_pattern?(variable.value) + + check_name(node, variable.value, variable.loc.expression) + end + end + + private + + def message(style) + format(MSG, style: style) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/verified_doubles.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/verified_doubles.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/verified_doubles.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/verified_doubles.rb index 7906cc221267499d4421eb16a8a247cd4c85885c..1dc1d049491e97aabf03177558af5fabf4c2761c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/verified_doubles.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/verified_doubles.rb @@ -22,7 +22,7 @@ module RuboCop # let(:foo) do # instance_double("ClassName", method_name: 'returned value') # end - class VerifiedDoubles < Cop + class VerifiedDoubles < Base MSG = 'Prefer using verifying doubles over normal doubles.' def_node_matcher :unverified_double, <<-PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/void_expect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/void_expect.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/void_expect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/void_expect.rb index 11c5f49cbd0ea27d426f6c6d336e8ea59aa6b55f..0f320e54ca85398b508e03f77098b20d8bfb4428 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/void_expect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/void_expect.rb @@ -11,7 +11,7 @@ module RuboCop # # # good # expect(something).to be(1) - class VoidExpect < Cop + class VoidExpect < Base MSG = 'Do not use `expect()` without `.to` or `.not_to`. ' \ 'Chain the methods or remove it.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/yield.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/yield.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/yield.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/yield.rb index 22d6839e1e24313a6b36c9d3a9318ad19b8d608c..df43511157997408d4b2698d4026b680d63944cc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec/yield.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec/yield.rb @@ -11,7 +11,7 @@ module RuboCop # # # good # expect(foo).to be(:bar).and_yield(1) - class Yield < Cop + class Yield < Base extend AutoCorrector include RangeHelp diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec_cops.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec_cops.rb index 4fe56e9974c398656a26a0dd8d02d66778e62579..b835bf3d68cfef24935bad50b79076828df4c23a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/cop/rspec_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/cop/rspec_cops.rb @@ -65,6 +65,7 @@ require_relative 'rspec/message_spies' require_relative 'rspec/missing_example_group_argument' require_relative 'rspec/multiple_describes' require_relative 'rspec/multiple_expectations' +require_relative 'rspec/multiple_memoized_helpers' require_relative 'rspec/multiple_subjects' require_relative 'rspec/named_subject' require_relative 'rspec/nested_groups' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/align_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/align_let_brace.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/align_let_brace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/align_let_brace.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/concept.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/concept.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/concept.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/concept.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/config_formatter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/config_formatter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/config_formatter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/config_formatter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/corrector/move_node.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/corrector/move_node.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/corrector/move_node.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/corrector/move_node.rb index d85ff6c7070511119acdb566a1d9f540dc7051be..b8a44db12d432a62c1667113acea1230215ddfe5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/corrector/move_node.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/corrector/move_node.rb @@ -16,19 +16,21 @@ module RuboCop @processed_source = processed_source # used by RangeHelp end - def move_before(other) # rubocop:disable Metrics/AbcSize + def move_before(other) position = other.loc.expression - indent = "\n" + ' ' * other.loc.column + indent = ' ' * other.loc.column + newline_indent = "\n#{indent}" - corrector.insert_before(position, source(original) + indent) + corrector.insert_before(position, source(original) + newline_indent) corrector.remove(node_range_with_surrounding_space(original)) end def move_after(other) position = final_end_location(other) - indent = "\n" + ' ' * other.loc.column + indent = ' ' * other.loc.column + newline_indent = "\n#{indent}" - corrector.insert_after(position, indent + source(original)) + corrector.insert_after(position, newline_indent + source(original)) corrector.remove(node_range_with_surrounding_space(original)) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/description_extractor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/description_extractor.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/description_extractor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/description_extractor.rb index 69410dbcbe24b4024291b23cfb43e498dceb88c5..52e71cb88b5e7c4a40e8b8a53d3a1f7ac8adb416 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/description_extractor.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/description_extractor.rb @@ -21,7 +21,7 @@ module RuboCop # Decorator of a YARD code object for working with documented rspec cops class CodeObject - COP_CLASS_NAME = 'RuboCop::Cop::RSpec::Cop' + COP_CLASS_NAME = 'RuboCop::Cop::RSpec::Base' RSPEC_NAMESPACE = 'RuboCop::Cop::RSpec' def initialize(yardoc) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/blank_line_separation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/empty_line_separation.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/blank_line_separation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/empty_line_separation.rb index 45375e7c5e7e61b856952d023619eea0c2116ed7..ac0b9d582332d799001ef7382b85da97f8cc4ec8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/blank_line_separation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/empty_line_separation.rb @@ -2,12 +2,23 @@ module RuboCop module RSpec - # Helps determine the offending location if there is not a blank line + # Helps determine the offending location if there is not an empty line # following the node. Allows comments to follow directly after. - module BlankLineSeparation + module EmptyLineSeparation include FinalEndLocation include RuboCop::Cop::RangeHelp + def missing_separating_line_offense(node) + return if last_child?(node) + + missing_separating_line(node) do |location| + msg = yield(node.method_name) + add_offense(location, message: msg) do |corrector| + corrector.insert_after(location.end, "\n") + end + end + end + def missing_separating_line(node) line = final_end_location(node).line diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/example.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/example.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/example_group.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/example_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/example_group.rb index e5928fe8ada4a99cf100ee49cedf8387930d2d7d..fe658d436a0bd950e9b5a5e9cdc15c594545c7d7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/example_group.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/example_group.rb @@ -36,9 +36,9 @@ module RuboCop # # Searches node and halts when a scope change is detected # - # @param node [RuboCop::Node] node to recursively search + # @param node [RuboCop::AST::Node] node to recursively search # - # @return [Array<RuboCop::Node>] discovered nodes + # @return [Array<RuboCop::AST::Node>] discovered nodes def find_all_in_scope(node, predicate) node.each_child_node.flat_map do |child| find_all(child, predicate) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/factory_bot.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/factory_bot.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/factory_bot.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/factory_bot.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/final_end_location.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/final_end_location.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/final_end_location.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/final_end_location.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/hook.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/hook.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language.rb index 1e5ef49dbe24cf0d2387108dac1f2b71baa8be5a..135e0baf2f0028aa795c99d8f13d18ad27e4873b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language.rb @@ -4,8 +4,6 @@ module RuboCop module RSpec # RSpec public API methods that are commonly used in cops module Language - RSPEC = '{(const {nil? cbase} :RSpec) nil?}' - # Set of method selectors class SelectorSet def initialize(selectors) @@ -29,7 +27,7 @@ module RuboCop end def block_pass_pattern - "(send #{RSPEC} #{node_pattern_union} _ block_pass)" + "(send #rspec? #{node_pattern_union} _ block_pass)" end def block_or_block_pass_pattern @@ -37,7 +35,11 @@ module RuboCop end def send_pattern - "(send #{RSPEC} #{node_pattern_union} ...)" + "(send #rspec? #{node_pattern_union} ...)" + end + + def send_or_block_or_block_pass_pattern + "{#{send_pattern} #{block_pattern} #{block_pass_pattern}}" end def node_pattern_union diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language/node_pattern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language/node_pattern.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language/node_pattern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language/node_pattern.rb index de4c1da27081e3c8e916c4a419f02761719a501a..82b0bbb0502ec2d1b2e040d4bd523ece243cc5a1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/language/node_pattern.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/language/node_pattern.rb @@ -7,6 +7,8 @@ module RuboCop module NodePattern extend RuboCop::NodePattern::Macros + def_node_matcher :rspec?, '{(const {nil? cbase} :RSpec) nil?}' + def_node_matcher :example_group?, ExampleGroups::ALL.block_pattern def_node_matcher :shared_group?, SharedGroups::ALL.block_pattern @@ -14,7 +16,7 @@ module RuboCop def_node_matcher :spec_group?, spec_groups.block_pattern def_node_matcher :example_group_with_body?, <<-PATTERN - (block #{ExampleGroups::ALL.send_pattern} args [!nil?]) + (block #{ExampleGroups::ALL.send_pattern} args !nil?) PATTERN def_node_matcher :example?, Examples::ALL.block_pattern @@ -23,6 +25,9 @@ module RuboCop def_node_matcher :let?, Helpers::ALL.block_or_block_pass_pattern + def_node_matcher :include?, + Includes::ALL.send_or_block_or_block_pass_pattern + def_node_matcher :subject?, Subject::ALL.block_pattern end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/node.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/node.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/node.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/node.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_describe.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_describe.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_describe.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_describe.rb index 4502ae27df725b75f9645f5a51c36c6ecdab8fa3..d637d6399844c5447d712d2fbfa234fec23207c6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/top_level_describe.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_describe.rb @@ -16,7 +16,7 @@ module RuboCop private def top_level_describe?(node) - return false unless node.method_name == :describe + return false unless node.method?(:describe) top_level_nodes.include?(node) end @@ -44,7 +44,7 @@ module RuboCop def describe_statement_children(node) node.each_child_node(:send).select do |element| - element.method_name == :describe + element.method?(:describe) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_group.rb new file mode 100644 index 0000000000000000000000000000000000000000..d8bc9bbda14c786ee0b331e0ffba47f72c840825 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/top_level_group.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module RuboCop + module RSpec + # Helper methods for top level example group cops + module TopLevelGroup + extend RuboCop::NodePattern::Macros + include RuboCop::RSpec::Language + + def_node_matcher :example_or_shared_group?, + (ExampleGroups::ALL + SharedGroups::ALL).block_pattern + + def on_new_investigation + super + + return unless root_node + + top_level_groups.each do |node| + example_group?(node, &method(:on_top_level_example_group)) + on_top_level_group(node) + end + end + + def top_level_groups + @top_level_groups ||= + top_level_nodes(root_node).select { |n| example_or_shared_group?(n) } + end + + private + + # Dummy methods to be overridden in the consumer + def on_top_level_example_group; end + + def on_top_level_group; end + + def top_level_group?(node) + top_level_groups.include?(node) + end + + def top_level_nodes(node) + if node.nil? + [] + elsif node.begin_type? + node.children + elsif node.module_type? || node.class_type? + top_level_nodes(node.body) + else + [node] + end + end + + def root_node + processed_source.ast + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/variable.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/variable.rb index 8be688258ab16ce02327d2c32edbbbab5c223d08..887f20ca7240e9e02b552ad6093d89bc2c7d26c7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/variable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/variable.rb @@ -8,7 +8,7 @@ module RuboCop extend RuboCop::NodePattern::Macros def_node_matcher :variable_definition?, <<~PATTERN - (send #{RSPEC} #{(Helpers::ALL + Subject::ALL).node_pattern_union} + (send nil? #{(Helpers::ALL + Subject::ALL).node_pattern_union} $({sym str dsym dstr} ...) ...) PATTERN end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/version.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/version.rb index 29371efb785eae542fa4152534ce65a8d2b55fab..5996b9bce6b16b342c43f51a2c3290898bdeeeeb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/version.rb @@ -4,7 +4,7 @@ module RuboCop module RSpec # Version information for the RSpec RuboCop plugin. module Version - STRING = '1.42.0' + STRING = '1.43.1' end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/wording.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.42.0/lib/rubocop/rspec/wording.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-1.43.1/lib/rubocop/rspec/wording.rb