metanorma/metanorma-iso

View on GitHub

Showing 38 of 49 total issues

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

      def style_two_regex_not_prev(n, text, regex, re_prev, warning)
Severity: Minor
Found in lib/metanorma/iso/validate_style.rb - About 35 mins to fix

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

          def disjunct_error(img, cond1, cond2, msg1, msg2)
    Severity: Minor
    Found in lib/metanorma/iso/validate_image.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/iso/processor.rb - About 35 mins to fix

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

              def termdef_warn(text, regex, elem, term, msg)
        Severity: Minor
        Found in lib/metanorma/iso/validate.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/iso/init.rb - About 35 mins to fix

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

                  def term_hash_init(hash, term, term2, term3, label)
            Severity: Minor
            Found in lib/isodoc/iso/index.rb - About 35 mins to fix

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

                    def clause_etc1(clause, out, num)
                      out.div **attr_code(
                        id: clause["id"],
                        class: clause.name == "definitions" ? "Symbols" : nil,
                      ) do |div|
              Severity: Minor
              Found in lib/isodoc/iso/base_convert.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 style_two_regex_not_prev has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def style_two_regex_not_prev(n, text, regex, re_prev, warning)
                      return if text.nil?
              
                      arr = Tokenizer::WhitespaceTokenizer.new.tokenize(text)
                      arr.each_index do |i|
              Severity: Minor
              Found in lib/metanorma/iso/validate_style.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

                      return 3 if bib.at("./docidentifier[@type]" \
              Severity: Major
              Found in lib/metanorma/iso/cleanup_biblio.rb - About 30 mins to fix

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

                    def style_list_iso(elem, level, listtype, idx)
                      return idx if elem.at(".//ol | .//ul") && !elem.at("./p")
                
                      idx += 1
                      ol = elem.xpath("./ancestor::ol")&.last
                Severity: Minor
                Found in lib/html2doc/lists.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 image_name_validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def image_name_validate(xmldoc)
                        prefix = image_name_prefix(xmldoc) or return
                        xmldoc.xpath("//image").each do |i|
                          next if i["src"].start_with?("data:")
                
                
                Severity: Minor
                Found in lib/metanorma/iso/validate_image.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 pub_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def pub_class(bib)
                        return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
                        return 1 if bib.at("#{PUBLISHER}[name = 'International Organization " \
                                           "for Standardization']")
                        return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
                Severity: Minor
                Found in lib/metanorma/iso/cleanup_biblio.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 isosubgroup_validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def isosubgroup_validate(root)
                        root.xpath("//technical-committee/@type").each do |t|
                          unless %w{TC PC JTC JPC}.include? t.text
                            @log.add("Document Attributes", nil,
                                     "invalid technical committee type #{t}")
                Severity: Minor
                Found in lib/metanorma/iso/validate.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 example_continued_style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def example_continued_style(docxml)
                        docxml.xpath("//div[@class = 'Example']").each do |d|
                          d.xpath("./p").each_with_index do |p, i|
                            p["class"] && p["class"] != "Example" and next
                            p["class"] = (i.zero? ? "Example" : "Examplecontinued")
                Severity: Minor
                Found in lib/isodoc/iso/word_dis_styles.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 vocab_terms_titles_validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def vocab_terms_titles_validate(root)
                        terms = root.xpath("//sections/terms | //sections/clause[.//terms]")
                        if terms.size == 1
                          ((t = terms.first.at("./title")) && (t&.text == @i18n.termsdef)) or
                            @log.add("Style", terms.first,
                Severity: Minor
                Found in lib/metanorma/iso/validate_section.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 ol_depth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def ol_depth(node)
                        depth = node.ancestors(@iso_class ? "ol" : "ul, ol").size + 1
                        type = :alphabet
                        type = :arabic if [2, 7].include? depth
                        type = :roman if [3, 8].include? depth
                Severity: Minor
                Found in lib/isodoc/iso/presentation_xml_convert.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 note_continued_style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def note_continued_style(docxml)
                        docxml.xpath("//div[@class = 'Note']").each do |d|
                          d.xpath("./p").each_with_index do |p, i|
                            p["class"] && p["class"] != "Note" and next
                            p["class"] = (i.zero? ? "Note" : "Notecontinued")
                Severity: Minor
                Found in lib/isodoc/iso/word_dis_styles.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 sort_biblio_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def sort_biblio_key(bib)
                        pubclass = pub_class(bib)
                        num = bib.at("./docnumber")&.text
                        id = bib.at("./docidentifier[@primary]") ||
                          bib.at("./docidentifier[not(#{skip_docid} or @type = 'metanorma')]")
                Severity: Minor
                Found in lib/metanorma/iso/cleanup_biblio.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