Showing 4 of 40 total issues
Class CLLI
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CLLI
##
# This module provides the various patterns used for parsing +CLLI+ strings.
module Pattern
##
Method state_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def state_name(region_code)
state_code = iso_state(region_code)
return unless state_code
country_code = iso_country(region_code)
return unless country_code
- 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 validate_attribute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_attribute(error_prefix, value, length, regexp, **options)
fail "#{error_prefix} cannot be nil." if value.nil?
fail "#{error_prefix} cannot be empty." if value.to_s.empty?
fail "#{error_prefix} must be #{length} #{pluralize(length, 'character')} long." unless value.to_s.size == length
return unless options[:strict]
- 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 validate_attribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def validate_attribute(error_prefix, value, length, regexp, **options)