metanorma/metanorma

View on GitHub

Showing 24 of 28 total issues

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

      def parse_docrefs_xml(mnf)
        mnf.xpath("xmlns:docref").map do |dr|
          h = { "identifier" => parse_docrefs_xml_id(dr) }
          %i(fileref url attachment sectionsplit index).each do |s|
            h[s.to_s] = dr[s] if dr[s]
Severity: Minor
Found in lib/metanorma/collection_manifest.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 read_anchors1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def read_anchors1(key, val, ret)
      val[:type] ||= "clause"
      ret[val[:type]] ||= {}
      index = if val[:container] || val[:label].nil? || val[:label].empty?
                UUIDTools::UUID.random_create.to_s
Severity: Minor
Found in lib/metanorma/files_lookup.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 docref_to_xml_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def docref_to_xml_attrs(elem, docref)
      f = docref["fileref"] and elem[:fileref] = @disambig.strip_root(f)
      %i(attachment sectionsplit url).each do |i|
        elem[i] = docref[i.to_s] if docref[i.to_s]
      end
Severity: Minor
Found in lib/metanorma/collection_manifest.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 extract has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def extract(isodoc, dirname, extract_types)
      return unless dirname

      extract_types.nil? || extract_types.empty? and
        extract_types = %i[sourcecode image requirement]
Severity: Minor
Found in lib/metanorma/extract.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