Showing 2 of 2 total issues
Method normalize_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def normalize_files(files)
# Add directories since they have to be invalidated
# as well if :directory_indexes is active
files += files.grep(INDEX_REGEX).map do |file|
file == 'index.html' ? '/' : File.dirname(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 ensure_required_options_present
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def ensure_required_options_present
[:api_key, :zone_id, :base_url].each do |key|
raise StandardError, "Configuration key #{key} is missing." if @options.public_send(key).nil?
end
- 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"