ucsdlib/damspas

View on GitHub
lib/dams/mads_name.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def get_value(name)
        el = elementList
        idx = 0
        while idx < el.size
          elem = el[idx]
Severity: Minor
Found in lib/dams/mads_name.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 authLabel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def authLabel
        # explicitly-set name overrides generated label
        if !name.first.blank?
          return name.first
        end      
Severity: Minor
Found in lib/dams/mads_name.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 to_solr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def to_solr (solr_doc={})
        if elementList.first
          Solrizer.insert_field(solr_doc, "name_element", nameValue)
          Solrizer.insert_field(solr_doc, "given_name_element", givenNameValue)
          Solrizer.insert_field(solr_doc, "full_name_element", fullNameValue)
Severity: Minor
Found in lib/dams/mads_name.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

There are no issues that match your filters.

Category
Status