metanorma/metanorma-standoc

View on GitHub

Showing 47 of 70 total issues

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

      def norm_id_memorize(node, res_table, selector, prefix, use_domain)
Severity: Minor
Found in lib/metanorma/standoc/term_lookup_cleanup.rb - About 35 mins to fix

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

          def progress_conv(idx, step, total, threshold, msg)
    Severity: Minor
    Found in lib/metanorma/standoc/cleanup_maths.rb - About 35 mins to fix

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

              def merge_by_type1(old, new, field, attributes, opt)
      Severity: Minor
      Found in lib/metanorma/standoc/merge_bibitems.rb - About 35 mins to fix

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

              def organization(org, orgname, node = nil, default_org = nil, attrs = {})
        Severity: Minor
        Found in lib/metanorma/standoc/front_organisation.rb - About 35 mins to fix

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

                def modify_ref_node(node, target)
                  node.name = "xref"
                  s = @lookup[:symbol][target]
                  t1 = @lookup[:sec2prim][target] and target = norm_ref_id1(t1)
                  t = @lookup[:term][target]
          Severity: Minor
          Found in lib/metanorma/standoc/term_lookup_cleanup.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 variant_space_cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def variant_space_cleanup(xmldoc)
                  xmldoc.xpath("//*[variant]").each do |c|
                    next if c.next.nil? || c.next.next.nil?
          
                    if c.next.text? && c.next.next.name == "variant"
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup.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 move_attrs_to_amend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def move_attrs_to_amend(clause, amend)
                  %w(change path path_end title).each do |e|
                    next unless clause[e]
          
                    amend[e] = clause[e]
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_amend.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 sectiontype has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def sectiontype(node, level = true)
                  ret = sectiontype1(node)
                  ret1 = preface_main_filter(sectiontype_streamline(ret), node)
                  ret1 == "symbols and abbreviated terms" and return ret1
                  !level || node.level == 1 || node.attr("heading") or return nil
          Severity: Minor
          Found in lib/metanorma/standoc/section.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 dumb2smart_quotesx has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def dumb2smart_quotesx(xmldoc)
                  # TODO?>
                  prev = ""
                  xmldoc.xpath("//* | //text()").each do |x|
                    x.is_a?(Nokogiri::XML::Node) or next
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_text.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 ref_dl_cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def ref_dl_cleanup(xmldoc)
                  xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
                    bib = dl_bib_extract(c) or next
                    validate_ref_dl(bib, c)
                    bibitemxml = RelatonBib::BibliographicItem.from_hash(bib).to_xml or next
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_asciibib.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 note_cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def note_cleanup(xmldoc)
                  xmldoc.xpath("//note").each do |n|
                    n["keep-separate"] == "true" || !n.ancestors("table").empty? and next
                    prev = n.previous_element || next
                    n.parent = prev if ELEMS_ALLOW_NOTES.include? prev.name
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_block.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 png_validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def png_validate(doc)
                  doc.xpath("//image[@mimetype = 'image/png']").each do |i|
                    Vectory::Utils::url?(i["src"]) and next
                    decoded = if Vectory::Utils::datauri?(i["src"])
                                Vectory::Utils::decode_datauri(i["src"])[:data]
          Severity: Minor
          Found in lib/metanorma/standoc/validate.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 hanging_para_style has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def hanging_para_style(root)
                  root.xpath("//clause | //annex | //foreword | //introduction | " \
                             "//acknowledgements").each do |c|
                    next unless c.at("./clause")
                    next if c.elements.reject do |n|
          Severity: Minor
          Found in lib/metanorma/standoc/validate_section.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 linebreak_cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def linebreak_cleanup(xmldoc)
                  xmldoc.traverse do |x|
                    x.text? && x.text.include?("\n") or next
                    ancestor_include?(x, PRESERVE_LINEBREAK_ELEMENTS) and next
                    ancestor_include?(x, STRIP_LINEBREAK_ELEMENTS) or next
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_text.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 mi_italicise? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def mi_italicise?(char)
                  char.length > 1 and return false
                  case char
                  when /\p{Greek}/
                    (/\p{Lower}/.match(char) && !mathml_mi_italics[:lowergreek]) ||
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_mathvariant.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 xref_cleanup1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def xref_cleanup1(xmldoc)
                  xmldoc.xpath("//xref").each do |x|
                    %r{:(?!//)}.match?(x["target"]) and xref_to_internal_eref(x)
                    x.name == "xref" or next
                    if refid? x["target"]
          Severity: Minor
          Found in lib/metanorma/standoc/cleanup_xref.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

          Avoid too many return statements within this method.
          Open

                  svg = File.read(path, encoding: "utf-8") or return false
          Severity: Major
          Found in lib/metanorma/standoc/cleanup_image.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return symbols_parse(attrs, xml, node)
            Severity: Major
            Found in lib/metanorma/standoc/terms.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return clause_parse(attrs, xml, node)
              Severity: Major
              Found in lib/metanorma/standoc/terms.rb - About 30 mins to fix

                Method empty_element_cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def empty_element_cleanup(xmldoc)
                        xmldoc.xpath("//#{TEXT_ELEMS.join(' | //')}").each do |x|
                          next if x.name == "name" && x.parent.name == "expression"
                
                          x.remove if x.children.empty?
                Severity: Minor
                Found in lib/metanorma/standoc/cleanup.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