SpeciesFileGroup/taxonworks

View on GitHub
lib/export/coldp/files/synonym.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method generate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate(otus, project_members, reference_csv = nil)
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}

Severity: Minor
Found in lib/export/coldp/files/synonym.rb - About 3 hrs 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 has too many lines. [38/25]
Open

  def self.generate(otus, project_members, reference_csv = nil)
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}

Severity: Minor
Found in lib/export/coldp/files/synonym.rb by rubocop

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 generate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.generate(otus, project_members, reference_csv = nil)
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}

Severity: Minor
Found in lib/export/coldp/files/synonym.rb - About 1 hr to fix

    TODO found
    Open

              # TODO: Confirm resolved: original combinations of invalid names are not being handled correclty in reified
    Severity: Minor
    Found in lib/export/coldp/files/synonym.rb by fixme

    TODO found
    Open

                  # TODO: This code block is erroneously removing basionyms from the synonyms section but we may need an improved form of it to remove duplicate synonyms (https://github.com/SpeciesFileGroup/taxonworks/issues/3482)
    Severity: Minor
    Found in lib/export/coldp/files/synonym.rb by fixme

    TODO found
    Open

                    nil,                                              # status  TODO: def status(taxon_name_id)
    Severity: Minor
    Found in lib/export/coldp/files/synonym.rb by fixme

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

                .where("(taxon_names.cached_original_combination != taxon_names.cached)")
    Severity: Minor
    Found in lib/export/coldp/files/synonym.rb by rubocop

    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