projectcypress/health-data-standards

View on GitHub
lib/health-data-standards/models/entry.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method times_to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def times_to_s(nil_string='UNK')
    if start_time.present? || end_time.present?
      start_string = start_time ? Entry.time_to_s(start_time) : nil_string
      end_string = end_time ? Entry.time_to_s(end_time) : nil_string
      "#{start_string} - #{end_string}"
Severity: Minor
Found in lib/health-data-standards/models/entry.rb - About 55 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 to_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def to_hash
    entry_hash = {}
    entry_hash['codes'] = codes
    unless values.empty?
      entry_hash['value'] = values
Severity: Minor
Found in lib/health-data-standards/models/entry.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 status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def status
    if status_code.present?
      if status_code['HL7 ActStatus']
        status_code['HL7 ActStatus'].first()
      elsif status_code['SNOMED-CT']
Severity: Minor
Found in lib/health-data-standards/models/entry.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 shift_dates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def shift_dates(date_diff)
    self.start_time = self.start_time.nil? ? nil : (self.start_time + date_diff)
    self.end_time = self.end_time.nil? ? nil : (self.end_time + date_diff)
    self.time = self.time.nil? ? nil : (self.time + date_diff)
  end
Severity: Minor
Found in lib/health-data-standards/models/entry.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