Showing 48 of 60 total issues
Class Config
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Config
FILE_NAME = '.scss-lint.yml'.freeze
DEFAULT_FILE = File.join(SCSS_LINT_HOME, 'config', 'default.yml')
attr_reader :options, :warnings, :file
Method find_comma_position
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def find_comma_position(arg) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
offset = 0
pos = arg.source_range.end_pos
if character_at(pos, offset) != ','
- 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 node_defined_earlier_in_branch?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def node_defined_earlier_in_branch?(node_to_look_in, looking_for)
# Look at all of the children of this node and return true if we find a
# defining node that matches in name and type.
node_to_look_in.children.each do |child_node|
break unless before?(child_node, looking_for[:location])
- 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 handle_runtime_exception
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_runtime_exception(exception, options) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength
case exception
when SCSSLint::Exceptions::InvalidCLIOption
log.error exception.message
log.info 'Run `scss-lint --help` for usage documentation'
Method check_for_space
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_for_space(node, string)
line = node.source_range.end_pos.line
if config['allow_single_line_padding'] && node_on_single_line?(node)
return unless string[-2] != ' '
- 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_node
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_node(node)
node.children.each_with_object([]) do |child_node, seen_nodes|
next unless child_node.is_a?(Sass::Tree::RuleNode)
next if whitelist_contains(child_node)
- 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 before_node_visit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def before_node_visit(node)
return unless (commands = Array(extract_commands(node))).any?
commands.each do |command|
linters = command[:linters]
- 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_bang
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_bang(node)
range = if node.respond_to?(:value_source_range)
node.value_source_range
else
node.source_range
- 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 compose_message
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def compose_message(orig_filename)
orig_basename = File.basename(orig_filename)
fixed_basename = orig_basename
if config['leading_underscore']
- 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_commas_after_args
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_commas_after_args(args, arg_type)
# For each arg except the last, check the character following the comma
args[0..-2].each do |arg|
# Sometimes the line we're looking at doesn't even contain a comma!
next unless engine.lines[arg.line - 1].include?(',')
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check(node, source) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@spaces = config['spaces']
source = trim_right_paren(source)
return if source.count('(') != source.count(')')
source.scan(/
- 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 extract_lengths
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_lengths(node)
case node
when Sass::Tree::PropNode
extract_lengths(node.value)
when Sass::Script::Tree::Literal
Method check_sort_order
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_sort_order(sortable_prop_info)
sortable_prop_info = sortable_prop_info.uniq { |item| item[:name] }
sorted_props = sortable_prop_info.sort { |a, b| compare_properties(a, b) }
sorted_props.each_with_index do |prop, index|
- 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_properties_alignment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_properties_alignment(rule_node)
properties = rule_node.children.select { |node| node.is_a?(Sass::Tree::PropNode) }
properties.each_slice(2) do |prop1, prop2|
next unless prop2
- 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_properties
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_properties(node)
static_properties(node).each_with_object({}) do |prop, prop_names|
prop_key = property_key(prop)
if existing_prop = prop_names[prop_key]
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check(node, operation_sources) # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Metrics/MethodLength
match = operation_sources.operator_source.match(/
(?<left_space>\s*)
(?<operator>\S+)
(?<right_space>\s*)
- 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 visit_simple_sequence
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit_simple_sequence(seq)
return unless seq_contains_sel_class?(seq, Sass::Selector::Element)
check_id(seq) unless config['allow_element_with_id']
check_class(seq) unless config['allow_element_with_class']
check_attribute(seq) unless config['allow_element_with_attribute']
- 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_property
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_property(node, prefix = nil) # rubocop:disable CyclomaticComplexity
return if contains_interpolation?(node)
name = prefix ? "#{prefix}-" : ''
name += node.name.join
- 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 feel_for_enclosing_parens
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
range = node.source_range
original_source = source_from_range(range)
left_offset = -1
right_offset = 0
- 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 assign_groups
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def assign_groups(order)
group_number = 0
last_was_empty = false
order.each_with_object({}) do |property, group|
- 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"