File taxon_concept.rb
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TaxonConcept < ApplicationRecord
include Deletable
extend Mobility
include TrackWhoDoesIt
has_paper_trail versions: { class_name: "TaxonConceptVersion" }, on: :destroy,
Class TaxonConcept
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class TaxonConcept < ApplicationRecord
include Deletable
extend Mobility
include TrackWhoDoesIt
has_paper_trail versions: { class_name: "TaxonConceptVersion" }, on: :destroy,
Method before_validate_full_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def before_validate_full_name
self.full_name =
if rank && parent && ['A', 'N'].include?(name_status)
rank_name = rank.name
parent_full_name = parent.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 expected_full_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def expected_full_name(parent)
if self.rank &&
Rank.in_range(Rank::VARIETY, Rank::SPECIES).include?(self.rank.name)
parent.full_name +
if self.rank.name == Rank::VARIETY
- 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 ensure_taxonomic_position
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_taxonomic_position
if new_record? && fixed_order_required? && taxonomic_position.blank?
prev_taxonomic_position =
if parent
last_sibling = TaxonConcept.where(:parent_id => parent_id).
- 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"