metanorma/asciidoctor-rfc

View on GitHub

Showing 82 of 82 total issues

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

    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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                  xml.ol **attr_code(ol_attributes) do |xml_ol|
                                    node.items.each do |item|
                                      li_attributes = {
                                        anchor: item.id,
                                      }
                        Severity: Minor
                        Found in lib/asciidoctor/rfc/v3/lists.rb and 1 other location - About 1 hr to fix
                        lib/asciidoctor/rfc/v3/lists.rb on lines 58..71

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 47.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                  xml.ul **attr_code(ul_attributes) do |xml_ul|
                                    node.items.each do |item|
                                      li_attributes = {
                                        anchor: item.id,
                                      }
                        Severity: Minor
                        Found in lib/asciidoctor/rfc/v3/lists.rb and 1 other location - About 1 hr to fix
                        lib/asciidoctor/rfc/v3/lists.rb on lines 110..122

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 47.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                ret = noko do |xml|
                                  if node.parent.context != :example
                                    figure_attributes = {
                                      anchor: node.id,
                                    }
                        Severity: Minor
                        Found in lib/asciidoctor/rfc/v2/blocks.rb and 1 other location - About 55 mins to fix
                        lib/asciidoctor/rfc/v2/blocks.rb on lines 35..49

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                ret = noko do |xml|
                                  if node.parent.context != :example
                                    figure_attributes = {
                                      anchor: node.id,
                                    }
                        Severity: Minor
                        Found in lib/asciidoctor/rfc/v2/blocks.rb and 1 other location - About 55 mins to fix
                        lib/asciidoctor/rfc/v2/blocks.rb on lines 68..82

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language