metanorma/metanorma-ieee

View on GitHub

Showing 30 of 30 total issues

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

    class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
      def multidef(elem)
        number_multidef(elem)
        collapse_multidef(elem)
      end
Severity: Minor
Found in lib/isodoc/ieee/presentation_terms.rb - About 4 hrs to fix

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

        class Converter < Standoc::Converter
          def initial_boilerplate(xml, isodoc)
            intro_boilerplate(xml, isodoc)
            super if @document_scheme == "ieee-sa-2021"
            xml.at("//boilerplate") or return
    Severity: Minor
    Found in lib/metanorma/ieee/cleanup.rb - About 3 hrs to fix

      Class PresentationXMLConvert has 27 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/ieee/presentation_xml_convert.rb - About 3 hrs to fix

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

            class Converter < Standoc::Converter
              BIBLIO =
                "//bibliography/references[@normative = 'false'][not(@hidden)] | " \
                "//bibliography/clause[.//references[@normative = 'false']] | " \
                "//annex//references[@normative = 'false'][not(@hidden)]".freeze
        Severity: Minor
        Found in lib/metanorma/ieee/cleanup_ref.rb - About 3 hrs to fix

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

              class Converter < Standoc::Converter
                def validate(doc)
                  content_validate(doc)
                  schema_validate(formattedstr_strip(doc.dup),
                                  File.join(File.dirname(__FILE__), "ieee.rng"))
          Severity: Minor
          Found in lib/metanorma/ieee/validate.rb - About 2 hrs to fix

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

                class Converter < Standoc::Converter
                  def metadata_committee(node, xml)
                    metadata_committee_prep(node) or return
                    xml.editorialgroup do |a|
                      committee_component("society", node, a)
            Severity: Minor
            Found in lib/metanorma/ieee/front.rb - About 2 hrs to fix

              Class WordConvert has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class WordConvert < IsoDoc::WordConvert
                    def authority_cleanup(docxml)
                      feedback_footnote(docxml)
                      %w(copyright license disclaimers participants).each do |t|
                        authority_cleanup1(docxml, t)
              Severity: Minor
              Found in lib/isodoc/ieee/word_authority.rb - About 2 hrs to fix

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

                    class WordConvert < IsoDoc::WordConvert
                      def initialize(options)
                        @libdir = File.dirname(__FILE__)
                        super
                        init_wp(options.dup)
                Severity: Minor
                Found in lib/isodoc/ieee/word_convert.rb - About 2 hrs to fix

                  Method stylesmap has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def stylesmap
                          {
                            example: "IEEEStdsParagraph",
                            MsoNormal: "IEEEStdsParagraph",
                            NormRef: "IEEEStdsParagraph",
                  Severity: Minor
                  Found in lib/isodoc/ieee/word_cleanup.rb - About 1 hr to fix

                    Method stylesmap has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def stylesmap
                            {
                              example: "IEEEStdsParagraph", # x
                              MsoNormal: "MsoBodyText",
                              NormRef: "MsoBodyText",
                    Severity: Minor
                    Found in lib/isodoc/ieee/word_wp_cleanup.rb - About 1 hr to fix

                      Method style_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def style_list(elem, level, liststyle, listnumber)
                            return unless liststyle
                      
                            sameelem_level = elem.ancestors.map(&:name).count(elem.parent.name)
                            if elem["style"]
                      Severity: Minor
                      Found in lib/html2doc/ieee/lists.rb - About 1 hr 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 list2para has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def list2para(list)
                            list.name == "ol" and return super
                            return if list.xpath("./li").empty?
                      
                            list.xpath("./li/p").each do |p|
                      Severity: Minor
                      Found in lib/html2doc/ieee_wp/lists.rb - About 1 hr 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

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

                            def ddMMMyyyy(isodate)
                              isodate.nil? and return nil
                              arr = isodate.split("-")
                              if arr.size == 1 && (/^\d+$/.match isodate)
                                Date.new(*arr.map(&:to_i)).strftime("%Y")
                      Severity: Major
                      Found in lib/isodoc/ieee/presentation_bibdata.rb and 1 other location - About 1 hr to fix
                      lib/isodoc/ieee/metadata.rb on lines 136..145

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

                      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

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

                            def ddMMMyyyy(isodate)
                              isodate.nil? and return nil
                              arr = isodate.split("-")
                              if arr.size == 1 && (/^\d+$/.match isodate)
                                Date.new(*arr.map(&:to_i)).strftime("%Y")
                      Severity: Major
                      Found in lib/isodoc/ieee/metadata.rb and 1 other location - About 1 hr to fix
                      lib/isodoc/ieee/presentation_bibdata.rb on lines 19..28

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

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

                          def list2para1(list, level, type)
                            list.xpath("./li").first["class"] ||= list_style(type, level, "First")
                            list.xpath("./li").last["class"] ||= list_style(type, level, "Last")
                            list.xpath("./li/p").each do |p|
                              p["class"] ||= list_style(type, level, "Middle")
                      Severity: Minor
                      Found in lib/html2doc/ieee/lists.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 std_docid_sdo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def std_docid_sdo(text)
                              found = false
                              text.split(%r{([\p{Zs}|/]+)}).reverse.map do |x|
                                if /[A-Za-z]/.match?(x)
                                  k = if found || agency?(x) then "std_publisher"
                      Severity: Minor
                      Found in lib/isodoc/ieee/init.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 onlychild_clause_validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def onlychild_clause_validate(root)
                              root.xpath(Standoc::Utils::SUBCLAUSE_XPATH).each do |c|
                                next unless c.xpath("../clause").size == 1
                      
                                title = c.at("./title")
                      Severity: Minor
                      Found in lib/metanorma/ieee/validate_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 listdepth_validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def listdepth_validate(doc)
                              doc.xpath("//ul[.//ul//ul]").each do |u|
                                next unless u.ancestors("ul").empty?
                      
                                @log.add("Style", u,
                      Severity: Minor
                      Found in lib/metanorma/ieee/validate.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 toWord(result, filename, dir, header)
                              ::Html2Doc::Ieee_Wp.new(
                                filename: filename,
                                imagedir: @localdir,
                                stylesheet: @wordstylesheet&.path,
                      Severity: Minor
                      Found in lib/isodoc/ieee/word_wp_cleanup.rb and 1 other location - About 40 mins to fix
                      lib/isodoc/ieee/word_cleanup.rb on lines 4..14

                      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 toWord(result, filename, dir, header)
                              ::Html2Doc::Ieee.new(
                                filename: filename,
                                imagedir: @localdir,
                                stylesheet: @wordstylesheet&.path,
                      Severity: Minor
                      Found in lib/isodoc/ieee/word_cleanup.rb and 1 other location - About 40 mins to fix
                      lib/isodoc/ieee/word_wp_cleanup.rb on lines 77..87

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language