metanorma/asciidoctor-rfc

View on GitHub

Showing 65 of 82 total issues

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

      def inline_anchor_xref(node)
        text = node.text
        if text =~ /^\S+ (of|comma|parens|bare)\b/
          # <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref
          matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
Severity: Minor
Found in lib/asciidoctor/rfc/v3/inline_anchor.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 11 (exceeds 5 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

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 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def inline_anchor_xref(node)
        text = node.text
        if text =~ /^\S+ (of|comma|parens|bare)\b/
          # <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref
          matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
Severity: Minor
Found in lib/asciidoctor/rfc/v3/inline_anchor.rb - About 1 hr to fix

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

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

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

          Method example has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def example(node)
                  figure_attributes = {
                    anchor: node.id,
                    align: node.attr("align"),
                    alt: node.alt,
          Severity: Minor
          Found in lib/asciidoctor/rfc/v2/blocks.rb - About 1 hr to fix

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

              Method example has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                    def example(node)
                      figure_attributes = {
                        anchor: node.id,
                        align: node.attr("align"),
                        alt: node.alt,
              Severity: Minor
              Found in lib/asciidoctor/rfc/v2/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 inline_quoted has 26 lines of code (exceeds 25 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 1 hr to fix

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

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

                    Method ulist has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def ulist(node)
                            result = []
                    
                            result << noko do |xml|
                              ul_attributes = {
                    Severity: Minor
                    Found in lib/asciidoctor/rfc/v3/lists.rb - About 1 hr to fix

                      Method link has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def link(node)
                              result = []
                              result << noko do |xml|
                                links = (node.attr("link") || "").split(/,\s*/)
                                links.each do |link|
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/v3/base.rb - About 55 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 cleanup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def cleanup(doc)
                              xmldoc = Nokogiri::XML(doc)
                              crefs = xmldoc.xpath("//cref")
                              # any crefs that are direct children of section should become children of the preceding
                              # paragraph, if it exists; otherwise, they need to be wrapped in a paragraph
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/v3/base.rb - About 55 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 extract_entities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def extract_entities(node, xmldoc)
                              refs = xmldoc.xpath("//reference")
                              ret = []
                              biblio = cache_biblio(node)
                              refs.each do |ref|
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/common/base.rb - About 45 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 quote has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def quote(node)
                              result = []
                              if node.blocks?
                                node.blocks.each do |b|
                                  result << send(b.context, b)
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/v2/blocks.rb - About 45 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 current_location has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def current_location(node)
                              return "Line #{node.lineno}" if node.respond_to?(:lineno) && !node.lineno.nil? && !node.lineno.empty?
                              return "ID #{node.id}" if node.respond_to?(:id) && !node.id.nil?
                              while !node.nil? && (!node.respond_to?(:level) || node.level > 0) && node.context != :section
                                node = node.parent
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/common/base.rb - About 45 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 workgroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def workgroup(node, xml)
                              workgroups = cache_workgroup(node)
                              node.attr("workgroup")&.split(/, ?/)&.each do |wg|
                                if wg =~ / (Working Group)$/i
                                  warn %(asciidoctor: WARNING (#{current_location(node)}): suffix "Working Group" will be stripped in published RFC from #{wg})
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/common/base.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 olist_naked has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def olist_naked(node, xml)
                              style = OLIST_TYPES[node.style.to_sym]
                              style = "empty" if node.attr("style") == "empty"
                              style = "format #{node.attr('format')}" unless node.attr("format").nil?
                              list_attributes = {
                      Severity: Minor
                      Found in lib/asciidoctor/rfc/v2/lists.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

                      Severity
                      Category
                      Status
                      Source
                      Language