team-umlaut/umlaut

View on GitHub
app/mixin_logic/metadata_helper.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

  def normalize_title(arg_title, options = {})
    # default options
    options[:rstrip_parens] ||= true
    options[:remove_all_parens] ||= true
    options[:strip_gmd] ||= true
Severity: Minor
Found in app/mixin_logic/metadata_helper.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 get_identifier has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def get_identifier(type, sub_scheme, referent, options = {} )
    options[:multiple] ||= false
    
    raise Exception.new("type must be :urn or :info") unless type == :urn or type == :info

Severity: Minor
Found in app/mixin_logic/metadata_helper.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 raw_search_title has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def raw_search_title(rft)
    # Just make one call to create metadata hash
    metadata = rft.metadata
    title = nil
    if rft.format == 'journal' && metadata['atitle']
Severity: Minor
Found in app/mixin_logic/metadata_helper.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 get_sudoc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_sudoc(rft)
    # Don't forget to unescape the sudoc that was escaped to maek it a uri!
    
    # Option 1: In a technically illegal but oh well info:sudoc uri
    
Severity: Minor
Found in app/mixin_logic/metadata_helper.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

There are no issues that match your filters.

Category
Status