ubpb/metacrunch-marcxml

View on GitHub

Showing 5 of 5 total issues

Method [] has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def [](query_string, flatten_subfields: true, values_as_hash: false)
        #
        # Control field query
        #
        if query_string.starts_with?("00")
Severity: Minor
Found in lib/metacrunch/marcxml/record.rb - About 2 hrs 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 attr has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def attr(name, value)
        element_name, element_data = @stack[-1]
        parent_name, parent_data   = @stack[-2]

        if element_name == :controlfield && parent_name == :record
Severity: Minor
Found in lib/metacrunch/marcxml/parser.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 end_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def end_element(name)
        element_name, element_data = @stack[-1]
        parent_name, parent_data   = @stack[-2]

        if element_name == :record
Severity: Minor
Found in lib/metacrunch/marcxml/parser.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 match_indicator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def match_indicator(requested_ind, datafield_ind)
        [*[requested_ind]].flatten.map do |_requested_ind|
          if !_requested_ind
            true
          elsif _requested_ind == :blank && (datafield_ind == " " || datafield_ind == "-" || datafield_ind == "_" || datafield_ind.nil?)
Severity: Minor
Found in lib/metacrunch/marcxml/record.rb - About 35 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 start_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def start_element(name)
        @stack << [name, {}]

        element_name, element_data = @stack[-1]
        parent_name, parent_data   = @stack[-2]
Severity: Minor
Found in lib/metacrunch/marcxml/parser.rb - About 35 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