metanorma/isodoc

View on GitHub

Showing 50 of 82 total issues

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

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

                      def case_with_markup(linkend, casing, script, firstonly: true)
                        seen = false
                        xml = Nokogiri::XML("<root>#{linkend}</root>")
                        xml.traverse do |b|
                          next unless b.text? && !seen
                  Severity: Minor
                  Found in lib/isodoc/class_utils.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.p **attr_code(para_attrs(node)) do |p|
                            unless @termdomain.empty?
                              p << "&#x3c;#{@termdomain}&#x3e; "
                              @termdomain = ""
                  Severity: Minor
                  Found in lib/isodoc/word_function/body.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

                  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

                  Avoid too many return statements within this method.
                  Open

                          return :roman if [3, 8].include? depth
                  Severity: Major
                  Found in lib/isodoc/xref/xref_counter.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            n = node["class"] and return n
                    Severity: Major
                    Found in lib/isodoc/word_function/body.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return :roman_upper if [5, 10].include? depth
                      Severity: Major
                      Found in lib/isodoc/xref/xref_counter.rb - About 30 mins to fix

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

                            def localpath(path)
                              return path if %r{^[A-Z]:|^/|^file:/}.match?(path)
                              return path unless (@sourcedir || @localdir) && path
                        
                              File.expand_path(File.join((@sourcedir || @localdir), path))
                        Severity: Minor
                        Found in lib/isodoc/css.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_table_parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def example_table_parse(node, out)
                                out.table **example_table_attr(node) do |t|
                                  t.tr do |tr|
                                    tr.td **EXAMPLE_TBL_ATTR do |td|
                                      example_label(node, td, node.at(ns("./name")))
                        Severity: Minor
                        Found in lib/isodoc/function/blocks_example_note.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 anchor_struct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def anchor_struct(lbl, container, elem, type, unnumb = false)
                                ret = {}
                                ret[:label] = unnumb == "true" ? nil : anchor_struct_label(lbl, elem)
                                ret[:xref] = anchor_struct_xref(unnumb == "true" ? "(??)" : lbl, elem)
                                ret[:xref].gsub!(/ $/, "")
                        Severity: Minor
                        Found in lib/isodoc/xref/xref_anchor.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 agency1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def agency1(xml)
                              agency = ""
                              publisher = []
                              xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'publisher']/" \
                                           "organization")).each do |org|
                        Severity: Minor
                        Found in lib/isodoc/metadata_contributor.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