Method normalise_path
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def normalise_path(path, top_level_dir = nil)
path = '' if path.nil?
# first replace '..', '~', '//', '\\', '/./', '\.\'
# ensure no double or more slashes
- 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 check_custom_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_custom_hash(hash, expected_keys)
fail ArgumentError, 'Hash must not be blank.' if hash.blank?
check_hash(hash)
fail ArgumentError, "Keys for #{hash} must not be empty." if expected_keys.blank?
fail ArgumentError, "Keys for #{hash} must be an array." unless expected_keys.is_a?(Array)
- 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 normalise_datetime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalise_datetime(value)
fail ArgumentError, 'Expected value to be a ActiveSupport::TimeWithZone, got blank.' if value.blank?
return value if value.is_a?(ActiveSupport::TimeWithZone)
- 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"