cli/lib/compass/sass_compiler.rb
Method when_compilation_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def when_compilation_error(error, sass_file, css_file, sourcemap_file)
@error_count += 1
if error.respond_to?(:sass_filename)
error_filename = error.sass_filename || sass_file
if relativize(error_filename) == relativize(sass_file)
- 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 when_updated_stylesheet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def when_updated_stylesheet(sass_file, css, sourcemap)
if css && display_compilation_times && @start_times[sass_file]
duration = ((Time.now - @start_times[sass_file]) * 1000).round / 1000.0
logger.record :write, "#{relativize(css)} (#{duration}s)"
else
- 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"