metanorma/isodoc

View on GitHub

Showing 112 of 112 total issues

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

              def initialize(lang, script, klass, i18n, options = {})
          Severity: Minor
          Found in lib/isodoc/xref.rb - About 35 mins to fix

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

                  def hierarchical_figure_body(num, subfignum, counter, block, klass)
            Severity: Minor
            Found in lib/isodoc/xref/xref_gen_seq.rb - About 35 mins to fix

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

                  def initialize(lang, script, locale, i18n, fonts_options = {})
              Severity: Minor
              Found in lib/isodoc/metadata.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 sequential_permission_body has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def sequential_permission_body(id, elem, label, klass, model, container: false)
                  Severity: Minor
                  Found in lib/isodoc/xref/xref_gen_seq.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

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

                            def make_figure_word_toc(docxml)
                              (docxml.at(figure_toc_xpath) && @tocfigurestitle) or return ""
                              toc = %{<p class="TOCTitle">#{@tocfigurestitle}</p>}
                              docxml.xpath(figure_toc_xpath).each do |h|
                                toc += word_toc_entry(1, header_strip(h))
                      Severity: Minor
                      Found in lib/isodoc/word_function/postprocess_toc.rb and 1 other location - About 35 mins to fix
                      lib/isodoc/word_function/postprocess_toc.rb on lines 127..134

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

                      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 reorder_comments_by_comment_link(docxml)
                              link_order = {}
                              docxml.xpath(COMMENT_TARGET_XREFS).each_with_index do |target, i|
                                link_order[target.value] = i
                              end
                      Severity: Minor
                      Found in lib/isodoc/html_function/comments.rb and 1 other location - About 35 mins to fix
                      lib/isodoc/word_function/comments.rb on lines 140..147

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

                      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 make_table_word_toc(docxml)
                              (docxml.at(table_toc_xpath) && @toctablestitle) or return ""
                              toc = %{<p class="TOCTitle">#{@toctablestitle}</p>}
                              docxml.xpath(table_toc_xpath).each do |h|
                                toc += word_toc_entry(1, header_strip(h))
                      Severity: Minor
                      Found in lib/isodoc/word_function/postprocess_toc.rb and 1 other location - About 35 mins to fix
                      lib/isodoc/word_function/postprocess_toc.rb on lines 142..149

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

                      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 reorder_comments_by_comment_link(docxml)
                              link_order = {}
                              docxml.xpath(COMMENT_TARGET_XREFS1).each_with_index do |target, i|
                                link_order[target.value] = i
                              end
                      Severity: Minor
                      Found in lib/isodoc/word_function/comments.rb and 1 other location - About 35 mins to fix
                      lib/isodoc/html_function/comments.rb on lines 131..138

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

                      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 prefix_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def prefix_name(node, delim, number, elem)
                            number.nil? || number.empty? and return
                            unless name = node.at(ns("./#{elem}"))
                              (node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
                                node.children.first.previous = "<#{elem}></#{elem}>"
                      Severity: Minor
                      Found in lib/isodoc/presentation_function/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

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

                            def reqt2class_nested_label(elem, model)
                              model.req_nested_class_paths.each do |n|
                                v1 = ns("/#{n[:xpath]}").sub(%r{^/}, "")
                                elem.at("./self::#{v1}") and return [n[:klass], n[:label]]
                              end
                      Severity: Minor
                      Found in lib/isodoc/xref/xref_gen_seq.rb and 1 other location - About 35 mins to fix
                      lib/isodoc/xref/xref_gen_seq.rb on lines 131..136

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

                      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 subsequence_increment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def subsequence_increment(node)
                              return increment_letter unless node["number"]
                      
                              @base = ""
                              @letter_override = node["number"]
                      Severity: Minor
                      Found in lib/isodoc/xref/xref_counter.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_tr_attr_style has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def make_tr_attr_style(cell, row, rowmax, totalrows, opt)
                              top = row.zero? ? "#{SW1} 1.5pt;" : "none;"
                              bottom = "#{SW1} #{rowmax >= totalrows ? '1.5' : '1.0'}pt;"
                              ret = <<~STYLE.gsub(/\n/, "")
                                border-top:#{top}mso-border-top-alt:#{top}
                      Severity: Minor
                      Found in lib/isodoc/word_function/table.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 figure_parse1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def figure_parse1(node, out)
                              out.div **figure_attrs(node) do |div|
                                node.children.each do |n|
                                  figure_key(out) if n.name == "dl"
                                  parse(n, div) unless n.name == "name"
                      Severity: Minor
                      Found in lib/isodoc/function/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 trim_hash1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def trim_hash1(hash)
                            hash.is_a?(Hash) or return hash
                            hash.each_with_object({}) do |(k, v), g|
                              blank?(v) and next
                              g[k] = case v
                      Severity: Minor
                      Found in lib/isodoc/presentation_function/metadata.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

                      Severity
                      Category
                      Status
                      Source
                      Language