codeRIT/hackathon_manager

View on GitHub
app/helpers/audit_helper.rb

Summary

Maintainability
A
1 hr
Test Coverage

Avoid too many return statements within this method.
Open

    return display_datetime(value, relative: false) if value.is_a? Time
Severity: Major
Found in app/helpers/audit_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return value.join(", ") if value.is_a? Array
    Severity: Major
    Found in app/helpers/audit_helper.rb - About 30 mins to fix

      Method display_audit_value has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
      Open

        def display_audit_value(value, field)
          return "(none)" if value.blank?
          return Questionnaire::POSSIBLE_ACC_STATUS[value] if field == "acc_status"
          return BusList.find(value)&.name || value if field == "bus_list_id"
          return User.find_by_id(value)&.full_name || "(deleted user)" if field == "checked_in_by_id"
      Severity: Minor
      Found in app/helpers/audit_helper.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