metanorma/metanorma-itu

View on GitHub

Showing 28 of 28 total issues

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

class Converter < Standoc::Converter
def metadata_status(node, xml)
stage = node.attr("status") || node.attr("docstage") || "published"
stage = "draft" if node.attributes.has_key?("draft")
xml.status do |s|
Severity: Minor
Found in lib/metanorma/itu/front.rb - About 3 hrs to fix

    Method ddMMMMYYYY has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def ddMMMMYYYY(date1, date2)
    m1 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date1
    m2 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date2
    if m1 && m1[:yr] && m1[:mo] && m1[:dd]
    dd1 = m1[:dd].sub(/^0/, "")
    Severity: Minor
    Found in lib/isodoc/itu/metadata_date.rb - About 2 hrs to fix

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

    class Converter < Standoc::Converter
    XML_ROOT_TAG = "itu-standard".freeze
    XML_NAMESPACE = "https://www.metanorma.org/ns/itu".freeze
     
    register_for "itu"
    Severity: Minor
    Found in lib/metanorma/itu/converter.rb - About 2 hrs to fix

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

      class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
      def initialize(options)
      @hierarchical_assets = options[:hierarchicalassets]
      super
      end
      Severity: Minor
      Found in lib/isodoc/itu/presentation_xml_convert.rb - About 2 hrs to fix

        Method ddMMMyyyy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def ddMMMyyyy(date)
        d = date.split("-").map { |x| x.sub(/^0/, "") }
        case @lang
        when "zh"
        d[0] += "å¹´" if d[0]
        Severity: Minor
        Found in lib/isodoc/itu/presentation_bibdata.rb - About 1 hr to fix

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

        def author(xml, _out)
        sector = xml.at(ns("//bibdata/ext/editorialgroup/sector"))
        set(:sector, sector.text) if sector
        bureau(xml)
        tc = xml.at(ns("//bibdata/ext/editorialgroup/committee"))
        Severity: Minor
        Found in lib/isodoc/itu/metadata.rb - About 55 mins to fix

        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/itu/presentation_ref.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, idents, _id, _standard, datefn, _bib)
          Severity: Minor
          Found in lib/isodoc/itu/presentation_ref.rb - About 45 mins to fix

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

            def meeting(xml)
            resolution =
            xml.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
            if o = xml.at(ns("//bibdata/ext/meeting-date/on"))&.text
            set(:meeting_date, resolution ? ddMMMMYYYY(o, nil) : ddMMMYYYY(o))
            Severity: Minor
            Found in lib/isodoc/itu/metadata.rb - About 45 mins to fix

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

            def authority_cleanup(docxml)
            dest = docxml.at("//div[@class = 'draft-warning']")
            auth = docxml.at("//div[@id = 'draft-warning']")
            dest and auth and dest.replace(auth.remove)
            %w(copyright license legal).each do |t|
            Severity: Minor
            Found in lib/isodoc/itu/word_cleanup.rb - About 45 mins to fix

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

            def annex(node, out)
            @meta.get[:doctype_original] == "recommendation-annex" or
            page_break(out)
            out.div **attr_code(id: node["id"], class: "Section3") do |s|
            annex_name(node, nil, s) unless node.at(ns("./fmt-title"))
            Severity: Minor
            Found in lib/isodoc/itu/base_convert.rb - About 45 mins to fix

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

            def biblio_list(clause, div, biblio)
            div.table class: "biblio", border: "0" do |t|
            i = 0
            t.tbody do |tbody|
            clause.elements.each do |b|
            Severity: Minor
            Found in lib/isodoc/itu/ref.rb - About 45 mins to fix

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

            def term_defs_boilerplate(div, _source, _term, _preface, _isodoc)
            Severity: Minor
            Found in lib/metanorma/itu/cleanup_section.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/itu/init.rb - About 35 mins to fix

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

                def termdef_warn(text, regex, node, term, msg)
                Severity: Minor
                Found in lib/metanorma/itu/validate.rb - About 35 mins to fix

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

                  def style_two_regex_not_prev(node, text, regex, regex_prev, warning)
                  Severity: Minor
                  Found in lib/metanorma/itu/validate.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/itu/processor.rb - About 35 mins to fix

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

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

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

                        def editor_table_entries(eds, ed_lbl, mail_lbl)
                        eds.each_with_index.with_object([]) do |(n, i), m|
                        mail = ""
                        n[:email] and
                        mail = "#{mail_lbl}<link target='mailto:#{n[:email]}'>" \
                        Severity: Minor
                        Found in lib/isodoc/itu/presentation_preface.rb - About 35 mins to fix

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

                        def pub_class(bib)
                        return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ITU']")
                        return 1 if bib.at("#{PUBLISHER}[name = 'International " \
                        "Telecommunication Union']")
                        return 2 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
                        Severity: Minor
                        Found in lib/metanorma/itu/cleanup.rb - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language