Showing 7 of 7 total issues
Method new
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.new(value)
return HashValue.new(value) if value.respond_to? :keys
return ArrayValue.new(value) if value.respond_to? :each
return NilValue.instance if value.nil?
return TrueValue.instance if value.is_a? TrueClass
- 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"
Further reading
Method handle_next
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.handle_next(options)
word_array = options[:word_array]
fail 'An error has occurred, this could be either user error or a bug. Please check your DSON is valid, and if it is, please raise a GitHub issue' if word_array.empty?
- 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"
Further reading
Avoid too many return
statements within this method. Open
Open
return NumericValue.new(value) if value.is_a? Integer or value.is_a? Float
Avoid too many return
statements within this method. Open
Open
return StringValue.new(value) if value.is_a? String
Avoid too many return
statements within this method. Open
Open
return NumericValue.so_parse(first_word) unless first_word.start_with? '"'
Avoid too many return
statements within this method. Open
Open
return NilValue.so_parse if first_word == 'empty'
Avoid too many return
statements within this method. Open
Open
return FalseValue.instance if value.is_a? FalseClass