lib/export/coldp/files/synonym.rb
Method generate
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
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}
- Read upRead up
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
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}
- Read upRead up
- Exclude checks
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
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}
TODO found Open
Open
# TODO: Confirm resolved: original combinations of invalid names are not being handled correclty in reified
- Exclude checks
TODO found Open
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)
- Exclude checks
TODO found Open
Open
nil, # status TODO: def status(taxon_name_id)
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
.where("(taxon_names.cached_original_combination != taxon_names.cached)")
- Read upRead up
- Exclude checks
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"