metanorma/metanorma-ietf

View on GitHub

Showing 27 of 29 total issues

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

      def review_note_parse(node, out)
        out.cref **attr_code(anchor: node["id"], display: node["display"],
                             source: node["reviewer"]) do |c|
          if name = node.at(ns("./name"))
            name.children.each { |n| parse(n, c) }
Severity: Minor
Found in lib/isodoc/ietf/blocks.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 figure_parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def figure_parse(node, out)
        node["class"] == "pseudocode" || node["type"] == "pseudocode" and
          return pseudocode_parse(node, out)
        @in_figure = true
        out.figure **attr_code(anchor: node["id"]) do |div|
Severity: Minor
Found in lib/isodoc/ietf/blocks.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 date_attr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def date_attr(date)
        date.nil? and return nil
        if date.length == 4 && date =~ /^\d\d\d\d$/ then { year: date }
        elsif /^\d\d\d\d-?\d\d$/.match?(date)
          m = /^(?<year>\d\d\d\d)-(?<month>\d\d)$/.match date
Severity: Minor
Found in lib/isodoc/ietf/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

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

      def bcp14_cleanup(xmldoc)
        return unless @bcp_bold

        xmldoc.xpath("//strong").each do |s|
          next unless BCP_KEYWORDS.include?(s.text)
Severity: Minor
Found in lib/metanorma/ietf/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 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/ietf/processor.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 make_postamble has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def make_postamble(docxml)
        docxml.xpath("//figure").each do |f|
          a = f.at("./artwork | ./sourcecode") || next
          name = f.at("./name")&.remove
          b = a.xpath("./preceding-sibling::*")&.remove
Severity: Minor
Found in lib/isodoc/ietf/cleanup_blocks.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 make_table_footnote_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def make_table_footnote_text(node, _fnid, fnref)
      first = node.first_element_child
      noko do |xml|
        xml.t **attr_code(anchor: first ? first["id"] : nil) do |div|
          div << "[#{fnref}]  "
Severity: Minor
Found in lib/isodoc/ietf/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

Severity
Category
Status
Source
Language