SpeciesFileGroup/taxonworks

View on GitHub
app/helpers/type_materials/catalog_helper.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method has too many lines. [31/25]
Open

  def type_material_catalog_label(type_material, verbose = false) # Possibly parameterize biocurations: true, repository: true, identifiers: true
    t = type_material

    if t.nil? && verbose # Anticipate rendering in paper
      return '[TODO: Add type material]'

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

  def type_material_catalog_label(type_material, verbose = false) # Possibly parameterize biocurations: true, repository: true, identifiers: true
    t = type_material

    if t.nil? && verbose # Anticipate rendering in paper
      return '[TODO: Add type material]'
Severity: Minor
Found in app/helpers/type_materials/catalog_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 type_material_catalog_label has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def type_material_catalog_label(type_material, verbose = false) # Possibly parameterize biocurations: true, repository: true, identifiers: true
    t = type_material

    if t.nil? && verbose # Anticipate rendering in paper
      return '[TODO: Add type material]'
Severity: Minor
Found in app/helpers/type_materials/catalog_helper.rb - About 1 hr to fix

    Method type_material_collecting_event_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def type_material_collecting_event_label(collecting_event, verbose = false)
        missing = '[TODO: A document (preferred) or verbatim label in a collecting event must be provided]'
        if ce = collecting_event
          if ce.document_label
            return ::Utilities::Strings.linearize(ce.document_label)
    Severity: Minor
    Found in app/helpers/type_materials/catalog_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

    TODO found
    Open

        # TODO: add verbose warning when missing any identifier

    TODO found
    Open

      # TODO: move to collection object catalog helper when that is developed

    TODO found
    Open

      # TODO: we should, perhaps, drive this off dwc_occurrence

    TODO found
    Open

            v.push '[TODO: Repository NOT PROVIDED]'

    TODO found
    Open

          return '[TODO: Add type material]'

    TODO found
    Open

        # TODO: add option(?) to render all identifiers

    TODO found
    Open

        missing = '[TODO: A document (preferred) or verbatim label in a collecting event must be provided]'

    There are no issues that match your filters.

    Category
    Status