metanorma/metanorma-jis

View on GitHub

Showing 13 of 22 total issues

Class Converter has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Converter < ISO::Converter
      def org_abbrev
        super.merge("Japanese Industrial Standards" => "JIS")
      end

Severity: Minor
Found in lib/metanorma/jis/front.rb - About 2 hrs to fix

    Class PresentationXMLConvert has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
          def inline(docxml)
            super
            strong(docxml)
          end
    Severity: Minor
    Found in lib/isodoc/jis/presentation_xml_convert.rb - About 2 hrs to fix

      Method list2para_style has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def list2para_style(listtype, depth)
            case listtype
            when "ol"
              ret = case depth
                    when "1" then "margin-left: 36.0pt;"
      Severity: Minor
      Found in lib/html2doc/lists.rb - About 1 hr to fix

        Method norm_ref has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def norm_ref(node, out)
                node["hidden"] != "true" or return
                out.div class: "normref_div" do |div|
                  clause_name(node, node.at(ns("./title")), div, nil)
                  if node.name == "clause"
        Severity: Minor
        Found in lib/isodoc/jis/word_convert.rb - About 55 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 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

                def list_item_anchor_names(list, list_anchor, depth, prev_label,
          refer_list)
          Severity: Minor
          Found in lib/isodoc/jis/xref.rb - About 35 mins to fix

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

                  def xref_init(lang, script, _klass, labels, options)
            Severity: Minor
            Found in lib/isodoc/jis/init.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/jis/base_convert.rb - About 35 mins to fix

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

                      def output(xml, inname, outname, format, options = {})
                Severity: Minor
                Found in lib/metanorma/jis/processor.rb - About 35 mins to fix

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

                        def list_item_anchor_names(list, list_anchor, depth, prev_label,
                  refer_list)
                          c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
                          list.xpath(ns("./li")).each do |li|
                            bare_label, label =
                  Severity: Minor
                  Found in lib/isodoc/jis/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

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

                        def back_clauses_anchor_names(xml)
                          clause_order_back(xml).each do |a|
                            xml.xpath(ns(a[:path])).each do |c|
                              if c["commentary"] == "true" then commentary_names(c)
                              else preface_names(c)
                  Severity: Minor
                  Found in lib/isodoc/jis/xref.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 organization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def organization(xml, org, node = nil, default_org = nil)
                          org.is_a?(Hash) && org[:name] or org = { name: org }
                          abbrevs = org_abbrev
                          name_str = org[:name].is_a?(Hash) ? org[:name]["en"] : org[:name]
                          n = abbrevs.invert[org[:name]] and org = { name: n, abbr: org[:name] }
                  Severity: Minor
                  Found in lib/metanorma/jis/front.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