Showing 5 of 5 total issues

Method parse_blocks_input has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_blocks_input(input)
      current_block = nil
      inside_single_line_block = false
      inside_multi_line_block  = false

Severity: Minor
Found in lib/kss/comment_parser.rb - About 3 hrs 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 modifiers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def modifiers
      last_indent = nil
      modifiers = []

      return modifiers unless modifiers_comment
Severity: Minor
Found in lib/kss/section.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 initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(*paths_or_strings)
      @sections = {}

      paths_or_strings.each do |path_or_string|
        if Dir.exists?(path_or_string)
Severity: Minor
Found in lib/kss/parser.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 parse_blocks_input has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse_blocks_input(input)
      current_block = nil
      inside_single_line_block = false
      inside_multi_line_block  = false

Severity: Minor
Found in lib/kss/comment_parser.rb - About 1 hr to fix

    Method normalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def normalize(text_block)
          return text_block if @options[:preserve_whitespace]
    
          # Strip out any preceding [whitespace]* that occur on every line. Not
          # the smartest, but I wonder if I care.
    Severity: Minor
    Found in lib/kss/comment_parser.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

    Severity
    Category
    Status
    Source
    Language