Class CanIUse
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Compass::Core::CanIUse
include Singleton
DATA_FILE_NAME = File.join(Compass::Core.base_directory, "data", "caniuse.json")
DATA_FEATURE_FILES = Dir.glob(File.join(Compass::Core.base_directory, "data", "caniuse_extras", "**", "*.json"))
Method omitted_usage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def omitted_usage(browser, min_version, max_version = nil)
versions = versions(browser)
min_version = caniuse_version(browser, min_version)
max_version = caniuse_version(browser, max_version)
if max_version.nil?
- 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 requires_prefix
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def requires_prefix(browser, min_version, capability, capability_options_list)
min_version = caniuse_version(browser, min_version)
assert_valid_browser browser
assert_valid_capability capability
found_version = false
- 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 prefixed_usage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prefixed_usage(prefix, capability, capability_options_list)
assert_valid_prefix prefix
assert_valid_capability capability
usage = 0
browsers_with_prefix(prefix).each do |browser|
- 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 browser_ranges
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def browser_ranges(capability, prefix = nil, include_unprefixed_versions = true)
assert_valid_capability capability
browsers = prefix.nil? ? browsers() : browsers_with_prefix(prefix)
browsers.inject({}) do |m, browser|
browser_versions = versions(browser)
- 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"