sds/scss-lint

View on GitHub

Showing 60 of 60 total issues

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
Severity: Minor
Found in lib/scss_lint/linter/space_between_parens.rb - About 45 mins to fix

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|
Severity: Minor
Found in lib/scss_lint/linter/property_sort_order.rb - About 45 mins to fix

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def whitespace_after_colon(node)
      whitespace = []
      offset = 0
      start_pos = node.name_source_range.start_pos

Severity: Minor
Found in lib/scss_lint/linter/space_after_property_colon.rb and 1 other location - About 40 mins to fix
lib/scss_lint/linter/space_after_variable_colon.rb on lines 45..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def whitespace_after_colon(node)
      whitespace = []
      offset = 0
      start_pos = node.source_range.start_pos

Severity: Minor
Found in lib/scss_lint/linter/space_after_variable_colon.rb and 1 other location - About 40 mins to fix
lib/scss_lint/linter/space_after_property_colon.rb on lines 82..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(linter, filename, location, description, severity = :warning)
Severity: Minor
Found in lib/scss_lint/lint.rb - About 35 mins to fix

    Method check_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_url(url, node)
          return if url.start_with?('data:') || url.include?('${')
          uri = URI(url)
    
          if uri.scheme || uri.host
    Severity: Minor
    Found in lib/scss_lint/linter/url_format.rb - About 35 mins to fix

    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 act_on_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def act_on_options(options)
          log.color_enabled = options.fetch(:color, log.tty?)
          load_required_paths(options)
          load_reporters(options)
    
    
    Severity: Minor
    Found in lib/scss_lint/cli.rb - About 35 mins to fix

    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_group_separation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_group_separation(sortable_prop_info) # rubocop:disable AbcSize
          group_number = @group[sortable_prop_info.first[:property]]
    
          sortable_prop_info[0..-2].zip(sortable_prop_info[1..-1]).each do |first, second|
            next unless @group[second[:property]] != group_number
    Severity: Minor
    Found in lib/scss_lint/linter/property_sort_order.rb - About 35 mins to fix

    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 condense_to_one_value? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def condense_to_one_value?(top, right, bottom, left) # rubocop:disable Metrics/CyclomaticComplexity
          return unless allowed?(1)
          return unless top == right
    
          top == bottom && (bottom == left || left.nil?) ||
    Severity: Minor
    Found in lib/scss_lint/linter/shorthand.rb - About 35 mins to fix

    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_script_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def visit_script_string(node)
          return unless node.type == :identifier
          return if node.value.start_with?('calc(')
    
          node.value.scan(ZERO_UNIT_REGEX) do |match|
    Severity: Minor
    Found in lib/scss_lint/linter/zero_unit.rb - About 35 mins to fix

    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 multiple_parent_references? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def multiple_parent_references?(rule_node)
          return unless rules = rule_node.parsed_rules
    
          # Iterate over each sequence counting all parent references
          total_parent_references = rules.members.inject(0) do |sum, seq|
    Severity: Minor
    Found in lib/scss_lint/linter/mergeable_selector.rb - About 35 mins to fix

    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 last_child has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def last_child(node)
          last = node.children.inject(node) do |lowest, child|
            return lowest unless child.respond_to?(:line)
            lowest.line < child.line ? child : lowest
          end
    Severity: Minor
    Found in lib/scss_lint/control_comment_processor.rb - About 35 mins to fix

    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_files_from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_files_from(list)
          files = []
    
          list.each do |file|
            if File.directory?(file)
    Severity: Minor
    Found in lib/scss_lint/file_finder.rb - About 35 mins to fix

    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_else has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def visit_else(if_node, else_node)
          # Check each @else branch if there are multiple `@else if`s
          visit_else(else_node, else_node.else) if else_node.else
    
          # Skip @else statements on the same line as the previous @if, since we
    Severity: Minor
    Found in lib/scss_lint/linter/else_placement.rb - About 35 mins to fix

    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 report_lints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def report_lints(options, lints, files)
          sorted_lints = lints.sort_by { |l| [l.filename, l.location] }
          options.fetch(:reporters).each do |reporter, output|
            results = reporter.new(sorted_lints, files, log).report_lints
            next unless results
    Severity: Minor
    Found in lib/scss_lint/cli.rb - About 35 mins to fix

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def violated_convention(name_string, type)
          convention_name = convention_name(type)
    
          existing_convention = CONVENTIONS[convention_name]
    
    
    Severity: Minor
    Found in lib/scss_lint/linter/name_format.rb and 1 other location - About 35 mins to fix
    lib/scss_lint/linter/selector_format.rb on lines 83..94

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def violated_convention(name_string, type)
          convention_name = convention_name(type)
    
          existing_convention = CONVENTIONS[convention_name]
    
    
    Severity: Minor
    Found in lib/scss_lint/linter/selector_format.rb and 1 other location - About 35 mins to fix
    lib/scss_lint/linter/name_format.rb on lines 99..110

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method visit_sequence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def visit_sequence(sequence)
          line_offset = 0
          sequence.members.each do |member|
            line_offset += 1 if member =~ /\n/
            next unless chained_class?(member)
    Severity: Minor
    Found in lib/scss_lint/linter/chained_classes.rb - About 25 mins to fix

    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_script_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def visit_script_string(node)
          return unless node.type == :identifier
    
          non_string_values = remove_quoted_strings(node.value).split
          non_string_values.each do |value|
    Severity: Minor
    Found in lib/scss_lint/linter/trailing_zero.rb - About 25 mins to fix

    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_commands has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_commands(node)
          return unless comment = retrieve_comment_text(node)
    
          commands = []
          comment.split("\n").each_with_index do |comment_line, line_no|
    Severity: Minor
    Found in lib/scss_lint/control_comment_processor.rb - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language