compleatang/legal-markdown

View on GitHub

Showing 26 of 28 total issues

Avoid too many return statements within this method.
Open

        return[:type7, value.delete($1 + "."), "", $1, "."]
Severity: Major
Found in lib/legal_markdown/legal_to_markdown/leaders.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return[:type6, value.delete("(" + $1 + ")"), "(", $1, ")"]
    Severity: Major
    Found in lib/legal_markdown/legal_to_markdown/leaders.rb - About 30 mins to fix

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

        def self.optsjason opt, config, args
      
          config[:output][:jason] = false
          opt.on( '-j', '--to-json', 'Parse the Legal Markdown file and produce a JSON document.' ) do
            config[:output][:jason] = true
      Severity: Minor
      Found in lib/legal_markdown.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 set_the_parsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_the_parsers
            if @content[/\{\{/] && @headers
              self.extend LegalToMarkdown::Mixins
              @mixins = true
            end
      Severity: Minor
      Found in lib/legal_markdown/legal_to_markdown/load_source.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 romans_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def romans_setup( array_to_sub )
            if @r_l || @r_u
              array_to_sub[3] = RomanNumerals.to_roman_upper(array_to_sub[3]) if @r_u
              array_to_sub[3] = RomanNumerals.to_roman_lower(array_to_sub[3]) if @r_l
            end
      Severity: Minor
      Found in lib/legal_markdown/legal_to_markdown/leaders.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 get_selector_above has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_selector_above( selector )
            if @deep_leaders
              selector_above = "l" + (selector[1].to_i-1).to_s + "."
              selector_above = "l1." if selector_above == "l0."
            else
      Severity: Minor
      Found in lib/legal_markdown/legal_to_markdown/leaders.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