metanorma/metanorma-ietf

View on GitHub

Showing 27 of 27 total issues

Method xref_check has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

      def xref_check(xml)
        ret = []
        xml.xpath("//xref | //relref").each do |x|
          t = xml.at(".//*[@anchor = '#{x['target']}']") ||
            xml.at(".//*[@pn = '#{x['target']}']") or
Severity: Minor
Found in lib/isodoc/ietf/validation.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

Class RfcConvert has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

    class RfcConvert < ::IsoDoc::Convert
      def para_attrs(node)
        { keepWithNext: node["keep-with-next"],
          keepWithPrevious: node["keep-with-previous"],
          indent: node["indent"],
Severity: Minor
Found in lib/isodoc/ietf/blocks.rb - About 4 hrs to fix

    Class RfcConvert has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class RfcConvert < ::IsoDoc::Convert
          def em_parse(node, out)
            out.em do |e|
              node.children.each { |n| parse(n, e) }
            end
    Severity: Minor
    Found in lib/isodoc/ietf/inline.rb - About 3 hrs to fix

      Class RfcConvert has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class RfcConvert < ::IsoDoc::Convert
            def make_front(out, isoxml)
              info(isoxml, out)
              out.front do |front|
                title isoxml, front
      Severity: Minor
      Found in lib/isodoc/ietf/front.rb - About 3 hrs to fix

        Method xref_check has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def xref_check(xml)
                ret = []
                xml.xpath("//xref | //relref").each do |x|
                  t = xml.at(".//*[@anchor = '#{x['target']}']") ||
                    xml.at(".//*[@pn = '#{x['target']}']") or
        Severity: Major
        Found in lib/isodoc/ietf/validation.rb - About 2 hrs to fix

          Method common_rfc_pis has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def common_rfc_pis(node)
                  rfc_pis = {
                    artworkdelimiter: node.at(ns("//pi/artworkdelimiter"))&.text,
                    artworklines: node.at(ns("//pi/artworklines"))&.text,
                    authorship: node.at(ns("//pi/authorship"))&.text,
          Severity: Minor
          Found in lib/isodoc/ietf/section.rb - About 1 hr to fix

            Method set_pi has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def set_pi(node, pi)
                    rfc_pis = {
                      artworkdelimiter: node.attr("artworkdelimiter"),
                      artworklines: node.attr("artworklines"),
                      authorship: node.attr("authorship"),
            Severity: Minor
            Found in lib/metanorma/ietf/front.rb - About 1 hr to fix

              Method rfc_attributes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def rfc_attributes(docxml)
                      # t = Time.now.getutc
                      obs = xpath_comma(docxml
                        .xpath(ns("//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier[not(@scope)]")))
                      upd = xpath_comma(docxml
              Severity: Minor
              Found in lib/isodoc/ietf/section.rb - About 1 hr to fix

                Method address has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def address(addr, phone, fax, email, uri, out)
                Severity: Minor
                Found in lib/isodoc/ietf/front.rb - About 45 mins to fix

                  Method biblio_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def biblio_list(node, div, _biblio)
                          i = 0
                          node.xpath(ns("./bibitem | ./note")).each do |b|
                            next if implicit_reference(b)
                  
                  
                  Severity: Minor
                  Found in lib/isodoc/ietf/references.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 clause_parse_title has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
                  Severity: Minor
                  Found in lib/isodoc/ietf/section.rb - About 35 mins to fix

                    Method xref_init has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def xref_init(lang, script, klass, i18n, options)
                    Severity: Minor
                    Found in lib/isodoc/ietf/rfc_convert.rb - About 35 mins to fix

                      Method tr_parse has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def tr_parse(node, out, ord, totalrows, header)
                      Severity: Minor
                      Found in lib/isodoc/ietf/table.rb - About 35 mins to fix

                        Method output has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def output(isodoc_node, inname, outname, format, options = {})
                        Severity: Minor
                        Found in lib/metanorma/ietf/processor.rb - About 35 mins to fix

                          Method xml2rfc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                def xml2rfc(isodoc_node, inname, outname, format, options)
                          Severity: Minor
                          Found in lib/metanorma/ietf/processor.rb - About 35 mins to fix

                            Method para_parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def para_parse(node, out)
                                    out.t **attr_code(para_attrs(node)) do |p|
                                      unless @termdomain.empty?
                                        p << "&lt;#{@termdomain}&gt; "
                                        @termdomain = ""
                            Severity: Minor
                            Found in lib/isodoc/ietf/blocks.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 make_generic_footnote_text has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def make_generic_footnote_text(node, fnref)
                                  first = node.first_element_child
                                  noko do |xml|
                                    xml.fn do |_div|
                                      xml.t **attr_code(anchor: first ? first["id"] : nil) do |div|
                            Severity: Minor
                            Found in lib/isodoc/ietf/footnotes.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 admonition_parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def admonition_parse(node, out)
                                    type = node["type"]
                                    name = admonition_name(node, type)
                                    out.aside anchor: node["id"] do |t|
                                      admonition_name_parse(node, t, name) if name
                            Severity: Minor
                            Found in lib/isodoc/ietf/blocks.rb - About 25 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 date_attr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def date_attr(date)
                                    date.nil? and return nil
                                    if date.length == 4 && date =~ /^\d\d\d\d$/ then { year: date }
                                    elsif /^\d\d\d\d-?\d\d$/.match?(date)
                                      m = /^(?<year>\d\d\d\d)-(?<month>\d\d)$/.match date
                            Severity: Minor
                            Found in lib/isodoc/ietf/front.rb - About 25 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 make_postamble has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def make_postamble(docxml)
                                    docxml.xpath("//figure").each do |f|
                                      a = f.at("./artwork | ./sourcecode") || next
                                      name = f.at("./name")&.remove
                                      b = a.xpath("./preceding-sibling::*")&.remove
                            Severity: Minor
                            Found in lib/isodoc/ietf/cleanup_blocks.rb - About 25 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