gitlabhq/gitlab-ci

View on GitHub
lib/ansi2html.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Converter has 65 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Converter
    def on_0(s) reset()                            end
    def on_1(s) enable(STYLE_SWITCHES[:bold])      end
    def on_3(s) enable(STYLE_SWITCHES[:italic])    end
    def on_4(s) enable(STYLE_SWITCHES[:underline]) end
Severity: Major
Found in lib/ansi2html.rb - About 1 day to fix

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

        def handle_sequence(s)
          indicator = s[1]
          commands = s[2].split ';'
          terminator = s[3]
    
    
    Severity: Minor
    Found in lib/ansi2html.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 get_xterm_color_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_xterm_color_class(command_stack, prefix)
          # the 38 and 48 commands have to be followed by "5" and the color index
          return unless command_stack.length >= 2
          return unless command_stack[0] == "5"
    
    
    Severity: Minor
    Found in lib/ansi2html.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

    There are no issues that match your filters.

    Category
    Status