metanorma/asciidoctor-rfc

View on GitHub

Showing 65 of 82 total issues

Method document has 50 lines of code (exceeds 25 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

    Method series_info has 49 lines of code (exceeds 25 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 1 hr to fix

      Method inline_quoted has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def inline_quoted(node)
              noko do |xml|
                case node.type
                when :emphasis
                  xml.spanx node.text, style: "emph"
      Severity: Minor
      Found in lib/asciidoctor/rfc/v2/base.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 insert_biblio has 46 lines of code (exceeds 25 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 1 hr to fix

        Method section has 46 lines of code (exceeds 25 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 1 hr to fix

          Method inline_anchor_xref has 45 lines of code (exceeds 25 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 1 hr to fix

            Method document has a Cognitive Complexity of 14 (exceeds 5 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: Minor
            Found in lib/asciidoctor/rfc/v3/base.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 cleanup has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def cleanup(doc)
                    xmldoc = Nokogiri::XML(doc) do |config|
                      config.noent
                    end
            
            
            Severity: Minor
            Found in lib/asciidoctor/rfc/v2/base.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 common_rfc_pis has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def common_rfc_pis(node)
                    # Below are generally applicable Processing Instructions (PIs)
                    # that most I-Ds might want to use, common to v2 and v3.
                    # These are set only if explicitly specified, with the exception
                    # of compact and subcompact
            Severity: Minor
            Found in lib/asciidoctor/rfc/common/base.rb - About 1 hr to fix

              Method admonition has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def admonition(node)
                      result = []
                      if node.parent.context == :preamble
                        note_attributes = {
                          # default title provided: title is mandatory
              Severity: Minor
              Found in lib/asciidoctor/rfc/v2/blocks.rb - About 1 hr to fix

                Method cache_biblio has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def cache_biblio(node)
                        bibliocache_name = "#{Dir.home}/.asciidoc-rfc-biblio-cache.json"
                        # If we are required to, clear the biblio cache
                        if node.attr("flush-caches") == "true"
                          FileUtils.rm_f bibliocache_name
                Severity: Minor
                Found in lib/asciidoctor/rfc/common/base.rb - About 1 hr to fix

                  Method flatten_rawtext has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def flatten_rawtext(node)
                          result = []
                          if node.respond_to?(:blocks) && node.blocks?
                            node.blocks.each { |b| result << flatten_rawtext(b) }
                          elsif node.respond_to?(:lines)
                  Severity: Minor
                  Found in lib/asciidoctor/rfc/common/base.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 olist has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def olist(node)
                          result = []
                  
                          result << noko do |xml|
                            type = OLIST_TYPES[node.style.to_sym]
                  Severity: Minor
                  Found in lib/asciidoctor/rfc/v3/lists.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 admonition has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def admonition(node)
                          result = []
                          if node.parent.context == :preamble
                            note_attributes = {
                              removeInRFC: node.attr("remove-in-rfc"),
                  Severity: Minor
                  Found in lib/asciidoctor/rfc/v3/blocks.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 ref_section has 35 lines of code (exceeds 25 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 1 hr to fix

                    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

                      Method dlist has 33 lines of code (exceeds 25 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 1 hr to fix

                        Method merge_vspace has 33 lines of code (exceeds 25 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 1 hr to fix

                          Method cache_workgroup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def cache_workgroup(node)
                                  wgcache_name = "#{Dir.home}/.asciidoc-rfc-workgroup-cache.json"
                                  # If we are required to, clear the wg cache
                                  if node.attr("flush-caches") == "true"
                                    FileUtils.rm_f wgcache_name
                          Severity: Minor
                          Found in lib/asciidoctor/rfc/common/base.rb - About 1 hr to fix

                            Method table has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def table(node)
                                    noko do |xml|
                                      has_body = false
                                      # TODO iref belongs here
                            
                            
                            Severity: Minor
                            Found in lib/asciidoctor/rfc/v3/table.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

                            Severity
                            Category
                            Status
                            Source
                            Language