metanorma/isodoc

View on GitHub

Showing 82 of 82 total issues

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

    def preface_move1(clause, preface, float, prev, xpath)
      preface.elements.each do |x|
        ((x.name == "floating-title" || x.at(xpath)) &&
        xpath != "./self::*[not(following-sibling::*)]") or prev = x
        x.at(xpath) or next
Severity: Minor
Found in lib/isodoc/presentation_function/section.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 word_remove_pb_before_annex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def word_remove_pb_before_annex(docxml)
        docxml.xpath("//div[p/br]").each do |d|
          /^WordSection\d+_\d+$/.match(d["class"]) or next
          (d.elements[0].name == "p" && !d.elements[0].elements.empty?) or next
          (d.elements[0].elements[0].name == "br" &&
Severity: Minor
Found in lib/isodoc/word_function/postprocess.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

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

      def foreword(clause, out)
        page_break(out)
        out.div **attr_code(id: clause["id"]) do |s|
          clause_name(clause, clause.at(ns("./title")), s,
                      { class: "ForewordTitle" })
Severity: Minor
Found in lib/isodoc/function/section.rb and 1 other location - About 45 mins to fix
lib/isodoc/function/section.rb on lines 119..124

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 40.

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

      def abstract(clause, out)
        page_break(out)
        out.div **attr_code(id: clause["id"]) do |s|
          clause_name(clause, clause.at(ns("./title")), s,
                      { class: "AbstractTitle" })
Severity: Minor
Found in lib/isodoc/function/section.rb and 1 other location - About 45 mins to fix
lib/isodoc/function/section.rb on lines 99..104

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 40.

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 norm_ref_entry_code has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
Severity: Minor
Found in lib/isodoc/presentation_function/refs.rb - About 45 mins to fix

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

        def biblio_ref_entry_code(ordinal, ids, _id, _standard, datefn, _bib)
    Severity: Minor
    Found in lib/isodoc/presentation_function/refs.rb - About 45 mins to fix

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

            def word_colgroup(docxml)
              cells2d = {}
              docxml.xpath("//table[colgroup]").each do |t|
                w = colgroup_widths(t)
                t.xpath(".//tr").each_with_index { |_tr, r| cells2d[r] = {} }
      Severity: Minor
      Found in lib/isodoc/word_function/postprocess_table.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

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

            def ul_parse(node, out)
              out.div **attr_code(class: "ul_wrap") do |div|
                list_title_parse(node, div)
                div.ul **attr_code(ul_attrs(node)) do |ul|
                  node.children.each { |n| n.name == "name" or parse(n, ul) }
      Severity: Minor
      Found in lib/isodoc/function/lists.rb and 1 other location - About 40 mins to fix
      lib/isodoc/function/lists.rb on lines 56..60

      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 38.

      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

            def ol_parse(node, out)
              out.div **attr_code(class: "ol_wrap") do |div|
                list_title_parse(node, div)
                div.ol **attr_code(ol_attrs(node)) do |ol|
                  node.children.each { |n| n.name == "name" or parse(n, ol) }
      Severity: Minor
      Found in lib/isodoc/function/lists.rb and 1 other location - About 40 mins to fix
      lib/isodoc/function/lists.rb on lines 15..19

      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 38.

      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 make_tr_attr_style has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def make_tr_attr_style(cell, row, rowmax, totalrows, opt)
      Severity: Minor
      Found in lib/isodoc/word_function/table.rb - About 35 mins to fix

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

              def make_tr_attr(cell, row, totalrows, header, bordered)
        Severity: Minor
        Found in lib/isodoc/function/table.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, title, out, header_class = {})
          Severity: Minor
          Found in lib/isodoc/function/section_titles.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/init.rb - About 35 mins to fix

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

                    def clause_parse_title1(node, div, title, _out, header_class = {})
              Severity: Minor
              Found in lib/isodoc/function/section_titles.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/function/table.rb - About 35 mins to fix

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

                        def anchor_struct(lbl, container, elem, type, unnumb = false)
                  Severity: Minor
                  Found in lib/isodoc/xref/xref_anchor.rb - About 35 mins to fix

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

                        def preface_move1(clause, preface, float, prev, xpath)
                    Severity: Minor
                    Found in lib/isodoc/presentation_function/section.rb - About 35 mins to fix

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

                            def make_tr_attr(cell, row, totalrows, header, bordered)
                      Severity: Minor
                      Found in lib/isodoc/word_function/table.rb - About 35 mins to fix

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

                            def swap_renderer(oldklass, newklass, file, input_filename, debug)
                        Severity: Minor
                        Found in lib/isodoc/convert.rb - About 35 mins to fix

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

                                def make_tr_attr_style(row, rowmax, totalrows, _header, bordered)
                          Severity: Minor
                          Found in lib/isodoc/function/table.rb - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language