metanorma/metanorma-standoc

View on GitHub

Showing 47 of 70 total issues

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

      def figure_footnote_cleanup(xmldoc)
        nomatches = false
        until nomatches
          nomatches = true
          xmldoc.xpath(FIGURE_FN_XPATH).each do |s|
Severity: Minor
Found in lib/metanorma/standoc/cleanup_footnotes.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 redundant_bookmark_cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def redundant_bookmark_cleanup(xmldoc)
        xmldoc.xpath("//bookmark").each do |b|
          p = b
          while !p.xml? && p = p.parent
            p["id"] == b["id"] or next
Severity: Minor
Found in lib/metanorma/standoc/cleanup_inline.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 math_validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def math_validate(doc)
        doc.xpath("//m:math", "m" => MATHML_NS).each do |m|
          if m.parent["validate"] == "false"
            m.parent.delete("validate")
          else
Severity: Minor
Found in lib/metanorma/standoc/validate.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 variant_cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def variant_cleanup(xmldoc)
        variant_space_cleanup(xmldoc)
        xmldoc.xpath("//*[variant]").each do |c|
          next unless c.children.any? do |n|
            n.name != "variant" && (!n.text? || !n.text.gsub(/\s/, "").empty?)
Severity: Minor
Found in lib/metanorma/standoc/cleanup.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 which has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.which(cmd)
        exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
        ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
          exts.each do |ext|
            exe = File.join(path, "#{cmd}#{ext}")
Severity: Minor
Found in lib/metanorma/standoc/macros_plantuml.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 image_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def image_attributes(node)
        nodetarget = node.attr("target") || node.target
        if Gem.win_platform? && /^[a-zA-Z]:/.match?(nodetarget)
          nodetarget.prepend("/")
        end
Severity: Minor
Found in lib/metanorma/standoc/inline.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 alternate_termdefinitions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def alternate_termdefinitions(xmldoc)
        xmldoc.xpath("//term").each do |t|
          t.xpath("./definition").each do |d|
            d1 = d.next_element or next
            if (v = d.at("./verbal-definition")) &&
Severity: Minor
Found in lib/metanorma/standoc/cleanup_terms.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