rkh/mustermann

View on GitHub

Showing 23 of 23 total issues

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

        def nested(type, opening, closing, *separators)
          element(type, opening) do
            char = nil
            until char == closing or scanner.eos?
              highlight(Regexp.union(closing, *separators))
Severity: Minor
Found in mustermann-contrib/lib/mustermann/visualizer/highlighter/ad_hoc.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 encoded has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def encoded(char, uri_decode: true, space_matches_plus: true, **options)
        return Regexp.escape(char) unless uri_decode
        encoded = escape(char, escape: /./)
        list    = [escape(char), encoded.downcase, encoded.upcase].uniq.map { |c| Regexp.escape(c) }
        if char == " "
Severity: Minor
Found in mustermann/lib/mustermann/ast/compiler.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 expand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def expand(behavior = nil, values = {})
      return to_s if values.empty? or behavior == :ignore
      raise ExpandError,    "cannot expand with keys %p" % values.keys.sort if behavior == :raise
      raise ArgumentError,  "unknown behavior %p"        % behavior         if behavior != :append
      params    = values.map { |key, value| @@uri.escape(key.to_s) + "=" + @@uri.escape(value.to_s, /[^\w]/) }
Severity: Minor
Found in mustermann/lib/mustermann/identity.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