asciidoctor/asciidoctor-doctest

View on GitHub

Showing 7 of 7 total issues

Method parse has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(input, group_name)
        examples = []
        current = create_example(nil)
        in_comment = false

Severity: Minor
Found in lib/asciidoctor/doctest/io/xml.rb - About 2 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 generate! has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def generate!(pattern: '*:*', rewrite: false)
        updated = []

        @input_suite.pair_with(@output_suite).each do |input, output|
          next unless input.name_match? pattern
Severity: Minor
Found in lib/asciidoctor/doctest/generator.rb - About 2 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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(opts = {})
        opts = opts.rekey(&:to_sym).rekey(:backend_name => :backend)

        template_dirs = Array(opts[:template_dirs]).freeze
        template_dirs.each do |path|
Severity: Minor
Found in lib/asciidoctor/doctest/asciidoc_converter.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 text_block_boundary? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def text_block_boundary?(node, side)
        method = { left: :previous_sibling, right: :next_sibling }[side]

        return true if node.send(method).try(:name) == 'br'
        loop do
Severity: Minor
Found in lib/asciidoctor/doctest/html_normalizer.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(input, group_name)
        examples = []
        current = create_example(nil)

        input.each_line do |line|
Severity: Minor
Found in lib/asciidoctor/doctest/io/asciidoc.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 summary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def summary
        str = String.new("#{count} examples (")
        str << [
          ("#{passes} passed".color(:green) if passes > 0),
          ("#{failures} failed".color(:red) if failures > 0),
Severity: Minor
Found in lib/asciidoctor/doctest/test_reporter.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 normalize! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize!
        traverse do |node|
          case node.type

          when Nokogiri::XML::Node::ELEMENT_NODE
Severity: Minor
Found in lib/asciidoctor/doctest/html_normalizer.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