Showing 5 of 23 total issues
File builtin_contracts.rb
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Contracts
module Builtin
# Check that an argument is +Numeric+.
class Num
def self.valid?(val)
Class MethodHandler
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class MethodHandler
METHOD_REFERENCE_FACTORY = {
:class_methods => SingletonMethodReference,
:instance_methods => MethodReference
}.freeze
Method execute_on_target
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def execute_on_target(obj, name, method_type, current_engine, *args, &blk)
Method fail_if_invalid
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def fail_if_invalid(validator, arg, arg_pos, args_size, contract)
Method message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def message
s = []
s << header.to_s
s << " Expected: #{expected}"
s << " Actual: #{data[:arg].inspect}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"