metanorma/metanorma-ietf

View on GitHub

Showing 29 of 29 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 32 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 28 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 termnote_anchor_names has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def termnote_anchor_names(docxml)
                        docxml.xpath(ns("//term[descendant::termnote]")).each do |t|
                          c = IsoDoc::XrefGen::Counter.new
                          notes = t.xpath(ns("./termnote"))
                          notes.each do |n|
                Severity: Minor
                Found in lib/isodoc/ietf/xref.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 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 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 u_cleanup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def u_cleanup(xmldoc)
                          xmldoc.traverse do |n|
                            next unless n.text?
                            next unless %w(t blockquote li dd preamble td th annotation)
                              .include? n.parent.name
                  Severity: Minor
                  Found in lib/isodoc/ietf/cleanup_inline.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 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 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 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 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 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 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_table_footnote_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def make_table_footnote_text(node, _fnid, fnref)
                                  first = node.first_element_child
                                  noko do |xml|
                                    xml.t **attr_code(anchor: first ? first["id"] : nil) do |div|
                                      div << "[#{fnref}]  "
                            Severity: Minor
                            Found in lib/isodoc/ietf/footnotes.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