metanorma/asciidoctor-rfc

View on GitHub

Showing 65 of 82 total issues

File base.rb has 425 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "date"
require "nokogiri"
require "htmlentities"
require "json"
require "pathname"
Severity: Minor
Found in lib/asciidoctor/rfc/common/base.rb - About 6 hrs to fix

    Method address has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

          def address(node, suffix, xml)
            email = node.attr("email#{suffix}")
            facsimile = node.attr("fax#{suffix}")
            phone = node.attr("phone#{suffix}")
            street = node.attr("street#{suffix}")
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/front.rb - About 4 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 inline_anchor_xref has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

          def inline_anchor_xref(node)
            if node.text =~ /^\S+ (of|comma|parens|bare)\b/
              # <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref:
              # render equivalent in v2
              matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/inline_anchor.rb - About 4 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 dlist_naked has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

          def dlist_naked(node, xml)
            style = "hanging"
            style = "empty" if node.attr("style") == "empty"
            list_attributes = {
              hangIndent: node.attr("hang-indent"),
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/lists.rb - About 4 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 series_info has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

          def series_info(node, xml)
            docname = node.attr("name")
            return if docname.nil? || docname&.empty?
            is_rfc = docname =~ /^rfc-?/i || node.attr("doctype") == "rfc"
    
    
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/front.rb - About 4 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 dlist has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

          def dlist(node)
            result = []
    
            result << noko do |xml|
              dl_attributes = {
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/lists.rb - About 4 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 section has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

          def section(node)
            result = []
            if node.attr("style") == "bibliography" ||
                node.parent.context == :section && node.parent.attr("style") == "bibliography"
              $xreftext = {}
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/base.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 ref_section has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def ref_section(node)
            result = []
            $processing_reflist = true
            references_attributes = {
              anchor: node.id,
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/base.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 document has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def document(node)
            $seen_back_matter = false
            $smart_quotes = (node.attr("smart-quotes") != "false")
            $inline_definition_lists = (node.attr("inline-definition-lists") == "true")
    
    
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/base.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_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_head_body_and_foot has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def table_head_body_and_foot(node, xml)
            [:head, :body, :foot].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
              tblsec_tag = "t#{tblsec}"
              # "anchor" attribute from tblsec.id not supported
              xml.send tblsec_tag do |xml_tblsec|
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/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 address has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

          def address(node, suffix, xml)
            email = node.attr("email#{suffix}")
            facsimile = node.attr("fax#{suffix}")
            phone = node.attr("phone#{suffix}")
            postalline = node.attr("postal-line#{suffix}")
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/front.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 merge_vspace has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

          def merge_vspace(node)
            nodes = []
            newnodes = []
            node.children.each do |element|
              nodes << element
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/base.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 inline_quoted has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

          def inline_quoted(node)
            noko do |xml|
              case node.type
              when :emphasis then xml.em node.text
              when :strong
    Severity: Minor
    Found in lib/asciidoctor/rfc/v3/base.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

    File base.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "pp"
    # coding: utf-8
    module Asciidoctor
      module RFC::V2
        module Base
    Severity: Minor
    Found in lib/asciidoctor/rfc/v2/base.rb - About 2 hrs to fix

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

            def insert_biblio(node, xmldoc)
              # we want no references in this document, so we can ignore any anchors of references
              xmldoc.xpath("//referencegroup | //reference").each(&:remove)
              refs = Set.new
              xmldoc.xpath("//xref | //relref").each { |r| refs << r["target"] }
      Severity: Minor
      Found in lib/asciidoctor/rfc/common/base.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 address1 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def address1(node, suffix, xml_address)
              postalline = node.attr("postal-line#{suffix}")
              street = node.attr("street#{suffix}")
              xml_address.postal do |xml_postal|
                if postalline.nil?
      Severity: Minor
      Found in lib/asciidoctor/rfc/v3/front.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 section has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def section(node)
              if node.attr("style") == "bibliography" ||
                  node.parent.context == :section && node.parent.attr("style") == "bibliography"
                result = ref_section(node)
              else
      Severity: Minor
      Found in lib/asciidoctor/rfc/v3/base.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 document has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def document(node)
              $seen_back_matter = false
              # If this is present, then BCP14 keywords in boldface are not assumed to be <bcp14> tags. By default they are.
              $bcp_bold = !(node.attr? "no-rfc-bold-bcp14")
              $smart_quotes = (node.attr("smart-quotes") != "false")
      Severity: Major
      Found in lib/asciidoctor/rfc/v3/base.rb - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language