Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Do some tweaking of the rubocop settings
Browse files Browse the repository at this point in the history
  • Loading branch information
petergoldstein authored and pirj committed Apr 8, 2022
1 parent 071692f commit e0d2516
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
13 changes: 9 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ Style/Encoding:

# This should go down over time.
Metrics/AbcSize:
Max: 283
Max: 40

# This should go down over time.
Layout/LineLength:
Max: 172
Max: 130
Exclude:
- features/**/*
- spec/**/*

# This should go down over time.
Metrics/MethodLength:
Max: 134
Max: 39

# This should go down over time.
Metrics/CyclomaticComplexity:
Expand Down Expand Up @@ -97,4 +100,6 @@ Lint/IneffectiveAccessModifier:
- lib/rspec/core/memoized_helpers.rb # Fixing this file was too much of a diff

Metrics/BlockLength:
Max: 2373
Max: 206
Exclude:
- spec/**/*.rb
6 changes: 4 additions & 2 deletions benchmarks/singleton_example_groups/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def old_configure_example(*)
class BenchmarkHelpers
def self.prepare_implementation(prefix)
RSpec.world = RSpec::Core::World.new # clear our state
RSpec::Core::Example.__send__ :alias_method, :with_around_and_singleton_context_hooks, :"#{prefix}_with_around_and_singleton_context_hooks"
RSpec::Core::Hooks::HookCollections.__send__ :alias_method, :register_global_singleton_context_hooks, :"#{prefix}_register_global_singleton_context_hooks"
RSpec::Core::Example.__send__ :alias_method, :with_around_and_singleton_context_hooks,
:"#{prefix}_with_around_and_singleton_context_hooks"
RSpec::Core::Hooks::HookCollections.__send__ :alias_method, :register_global_singleton_context_hooks,
:"#{prefix}_register_global_singleton_context_hooks"
RSpec::Core::Configuration.__send__ :alias_method, :configure_example, :"#{prefix}_configure_example"
end

Expand Down
5 changes: 5 additions & 0 deletions lib/rspec/core/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def bisect_runner=(value)
# @private
attr_reader :backtrace_formatter, :ordering_manager, :loaded_spec_files

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength

# Build an object to store runtime configuration options and set defaults
def initialize
# rubocop:disable Style/GlobalVars
Expand Down Expand Up @@ -559,6 +562,8 @@ def initialize

define_built_in_hooks
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

# @private
#
Expand Down
2 changes: 2 additions & 0 deletions lib/rspec/core/option_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def parse(source=nil)

private

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/PerceivedComplexity
Expand Down Expand Up @@ -301,6 +302,7 @@ def parser(options)
end
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity
Expand Down
5 changes: 4 additions & 1 deletion spec/rspec/core/filterable_item_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Core
RSpec.describe FilterableItemRepository, "#items_for" do
FilterableItem = Struct.new(:name)

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def self.it_behaves_like_a_filterable_item_repo(&when_the_repo_has_items_with_metadata)
let(:repo) { described_class.new(:any?) }
let(:item_1) { FilterableItem.new("Item 1") }
Expand Down Expand Up @@ -166,7 +168,8 @@ def self.it_behaves_like_a_filterable_item_repo(&when_the_repo_has_items_with_me
end
end
end

# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
describe FilterableItemRepository::UpdateOptimized do
it_behaves_like_a_filterable_item_repo
end
Expand Down

0 comments on commit e0d2516

Please sign in to comment.