lib/haml/string_splitter.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method shift_balanced_embexpr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def shift_balanced_embexpr(tokens)
          String.new.tap do |embedded|
            embexpr_open = 1

            until tokens.empty?
Severity: Minor
Found in lib/haml/string_splitter.rb - About 1 hr 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 compile_tokens! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def compile_tokens!(exps, tokens)
          beg_str, end_str = strip_quotes!(tokens)

          until tokens.empty?
            _, type, str = tokens.shift
Severity: Minor
Found in lib/haml/string_splitter.rb - About 1 hr 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 on_dynamic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def on_dynamic(code)
        return [:dynamic, code] unless string_literal?(code)
        return [:dynamic, code] if code.include?("\n")

        temple = [:multi]
Severity: Minor
Found in lib/haml/string_splitter.rb - About 55 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 compile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def compile(code)
          [].tap do |exps|
            tokens = Ripper.lex(code.strip)
            tokens.pop while tokens.last && [:on_comment, :on_sp].include?(tokens.last[1])

Severity: Minor
Found in lib/haml/string_splitter.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 string_literal? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def string_literal?(code)
        return false if SyntaxChecker.syntax_error?(code)

        type, instructions = Ripper.sexp(code)
        return false if type != :program
Severity: Minor
Found in lib/haml/string_splitter.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

There are no issues that match your filters.

Category
Status