SpeciesFileGroup/taxonworks

View on GitHub
app/models/georeference/verbatim_data.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

  def initialize(params = {})
    super

    self.is_median_z    = false
    self.is_undefined_z = false # and delta_z is zero, or ignored

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 initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(params = {})
    super

    self.is_median_z    = false
    self.is_undefined_z = false # and delta_z is zero, or ignored
Severity: Minor
Found in app/models/georeference/verbatim_data.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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(params = {})
    super

    self.is_median_z    = false
    self.is_undefined_z = false # and delta_z is zero, or ignored
Severity: Minor
Found in app/models/georeference/verbatim_data.rb - About 1 hr to fix

    Method check_obj_within_distance_from_area has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_obj_within_distance_from_area(distance)
        # case 6
        retval = true
        if collecting_event.present?
          if geographic_item.present? && collecting_event.geographic_area.present?
    Severity: Minor
    Found in app/models/georeference/verbatim_data.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

    TODO found
    Open

          geodeticDatum: nil  # TODO: check

    TODO found
    Open

    # !! TODO: presently does not include verbatim_geolocation_uncertainty translation into radius

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

          georeferenceSources: "Physical collection object.",

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    There are no issues that match your filters.

    Category
    Status