metanorma/asciidoctor-rfc

View on GitHub
lib/asciidoctor/rfc/v2/table.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method table_head has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def table_head(node, xml)
        [:head].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
          warn "asciidoctor: WARNING (#{current_location(node)}): RFC XML v2 tables only support a single header row" if node.rows[tblsec].size > 1
          widths = table_widths(node)
          node.rows[tblsec].each do |row|
Severity: Minor
Found in lib/asciidoctor/rfc/v2/table.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 table has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def table(node)
        has_body = false
        has_head = false
        style_value = case node.attr "grid"
                      when "all"
Severity: Minor
Found in lib/asciidoctor/rfc/v2/table.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 table has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def table(node)
        has_body = false
        has_head = false
        style_value = case node.attr "grid"
                      when "all"
Severity: Minor
Found in lib/asciidoctor/rfc/v2/table.rb - About 1 hr to fix

    There are no issues that match your filters.

    Category
    Status