Skip to content

Commit

Permalink
Use default Max for Metrics/PerceivedComplexity cop
Browse files Browse the repository at this point in the history
By explicitly disabling 4 violations.
  • Loading branch information
floehopper committed Nov 16, 2019
1 parent d19f853 commit e95716a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Metrics/ClassLength:
Metrics/MethodLength:
Max: 31

# Offense count: 4
Metrics/PerceivedComplexity:
Max: 11

# Offense count: 545
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ begin
rescue LoadError # rubocop:disable Lint/HandleExceptions
end

# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def benchmark_test_case(klass, iterations)
require 'benchmark'
require 'mocha/detection/mini_test'
Expand Down Expand Up @@ -120,7 +120,7 @@ def benchmark_test_case(klass, iterations)
Benchmark.realtime { iterations.times { Test::Unit::UI::Console::TestRunner.run(klass, @silent_option) } }
end
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity

if ENV['MOCHA_GENERATE_DOCS']
require 'yard'
Expand Down
4 changes: 2 additions & 2 deletions lib/mocha/cardinality.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def used?
@invocations.any? || maximum.zero?
end

# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def anticipated_times
if allowed_any_number_of_times?
'allowed any number of times'
Expand All @@ -73,7 +73,7 @@ def anticipated_times
"expected between #{required} and #{times(maximum)}"
end
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity

def invoked_times
"invoked #{times(@invocations.size)}"
Expand Down
4 changes: 2 additions & 2 deletions lib/mocha/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def all_expectations
end

# @private
# rubocop:disable Style/MethodMissingSuper,Metrics/CyclomaticComplexity
# rubocop:disable Style/MethodMissingSuper,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def method_missing(symbol, *arguments, &block)
if @responder && !@responder.respond_to?(symbol)
raise NoMethodError, "undefined method `#{symbol}' for #{mocha_inspect} which responds like #{@responder.mocha_inspect}"
Expand All @@ -328,7 +328,7 @@ def method_missing(symbol, *arguments, &block)
raise ExpectationErrorFactory.build("unexpected invocation: #{message}", caller)
end
end
# rubocop:enable Style/MethodMissingSuper,Metrics/CyclomaticComplexity
# rubocop:enable Style/MethodMissingSuper,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity

# @private
def respond_to_missing?(symbol, include_private = false)
Expand Down
2 changes: 2 additions & 0 deletions lib/mocha/parameter_matchers/includes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def initialize(*items)
end

# @private
# rubocop:disable Metrics/PerceivedComplexity
def matches?(available_parameters)
parameter = available_parameters.shift
return false unless parameter.respond_to?(:include?)
Expand All @@ -89,6 +90,7 @@ def matches?(available_parameters)
AllOf.new(*includes_matchers).matches?([parameter])
end
end
# rubocop:enable Metrics/PerceivedComplexity

# @private
def mocha_inspect
Expand Down

0 comments on commit e95716a

Please sign in to comment.