Class Output
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class NomenclatureChange::Output < ApplicationRecord
include TrackWhoDoesIt
attr_accessor :output_type # New taxon, Existing subspecies, Existing taxon
# Migrated to controller (Strong Parameters)
# attr_accessible :nomenclature_change_id, :taxon_concept_id,
Method tmp_taxon_concept
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def tmp_taxon_concept
name_status_to_save = (new_name_status.present? ? new_name_status : name_status)
scientific_name =
if ['A', 'N'].include?(name_status_to_save) && display_full_name
- 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 tmp_taxon_concept
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tmp_taxon_concept
name_status_to_save = (new_name_status.present? ? new_name_status : name_status)
scientific_name =
if ['A', 'N'].include?(name_status_to_save) && display_full_name
Method populate_taxon_concept_fields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def populate_taxon_concept_fields
self.parent_id = taxon_concept.parent_id_changed? ? taxon_concept.parent_id_was : taxon_concept.parent_id
self.rank_id = taxon_concept.rank_id_changed? ? taxon_concept.rank_id_was : taxon_concept.rank_id
self.scientific_name = taxon_concept.full_name_changed? ? taxon_concept.full_name_was : taxon_concept.full_name
self.author_year = taxon_concept.author_year_changed? ? taxon_concept.author_year_was : taxon_concept.author_year
- 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 validate_tmp_taxon_concept
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_tmp_taxon_concept
@tmp_taxon_concept = tmp_taxon_concept
unless @tmp_taxon_concept
errors.add(:new_taxon_concept, "can\'t be blank")
end
- 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 new_full_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new_full_name
return nil if new_scientific_name.blank?
rank = new_rank
parent = new_parent || nomenclature_change.new_output_parent
if parent && [Rank::SPECIES, Rank::SUBSPECIES].include?(rank.name)
- 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"