Showing 12,628 of 12,628 total issues
Method sv_validate_coordinated_names_page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_validate_coordinated_names_page
return true unless is_valid?
s = self.origin_citation
list_of_coordinated_names.each do |t|
ts = t.origin_citation
- 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_name_format
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_name_format(taxon_name)
if !taxon_name.name.blank?
taxon_name.errors.add(:name, 'name must be lower case') unless taxon_name.name == taxon_name.name.downcase
taxon_name.errors.add(:name, 'name must be at least two letters') unless taxon_name.name.length > 1
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 basis
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def basis
case dwc_occurrence_object_type
when 'CollectionObject'
if dwc_occurrence_object.is_fossil?
return 'FossilSpecimen'
- 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 loan_return_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def loan_return_date
if loan_item
loan_item&.loan&.date_return_expected ? loan_item.loan.date_return_expected : false
elsif c = loaned_in_container
i = c.loan_item
- 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 sv_validate_priority
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_validate_priority
if self.type_class.nomenclatural_priority == :direct
date1 = self.subject_taxon_name.cached_nomenclature_date
date2 = self.object_taxon_name.cached_nomenclature_date
if !!date1 && !!date2 && subject_invalid_statuses.empty?
- 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 nomenclature_code_matches
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def nomenclature_code_matches
if taxon_name && type && nomenclature_code
tn = taxon_name.type == 'Combination' ? taxon_name.protonyms.last : taxon_name
nc = tn.rank_class.nomenclatural_code
errors.add(:taxon_name, "#{taxon_name.cached_html} belongs to #{taxon_name.rank_class.nomenclatural_code} nomenclatural code, but the status used from #{nomenclature_code} nomenclature code") if nomenclature_code != nc
- 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 sv_fix_coordinated_names_original_genus
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_fix_coordinated_names_original_genus
fixed = false
return false unless self.original_genus.nil?
list_of_coordinated_names.each do |t|
if !t.original_genus.nil?
- 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 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?
- 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 sv_fix_subject_parent_update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_fix_subject_parent_update
res = false
if TAXON_NAME_RELATIONSHIP_NAMES_SYNONYM.include?(self.type_name)
obj = self.object_taxon_name
subj = self.subject_taxon_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 sv_fix_coordinated_names_original_subspecies
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_fix_coordinated_names_original_subspecies
fixed = false
return false unless self.original_subspecies.nil?
list_of_coordinated_names.each do |t|
if !t.original_subspecies.nil?
- 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 generate_uuid_if_required
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_uuid_if_required(force = false)
if force # really make sure there is an object to work with
create_object_uuid if !occurrence_identifier && !dwc_occurrence_object.nil? # TODO: can be simplified when inverse_of/validation added to identifiers
else # assume if occurrenceID is not blank identifier is present
if occurrenceID.blank?
- 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 sv_family_is_invalid_no_substitute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_family_is_invalid_no_substitute
if persisted? && is_family_rank? && self.id == self.lowest_rank_coordinated_taxon.id
if !TaxonNameClassification.where_taxon_name(self).with_type_base('TaxonNameClassification::Iczn::Available::Invalid').empty?
if self.iczn_set_as_synonym_of.nil?
soft_validations.add(:base, 'Missing relationship: The name is invalid, but a substitute name is not selected')
- 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 code_column
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.code_column(observation_matrix_column_id, observation_params)
c = ObservationMatrixColumn.find(observation_matrix_column_id)
o = ObservationMatrix.find(c.observation_matrix_id)
descriptor = c.descriptor
- 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 nuke
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def nuke
known = ApplicationRecord.subclasses.select {|a| a.column_names.include?('project_id')}.map(&:name)
known.each do |k|
next if k.constantize.table_name == 'test_classes' # TODO: a kludge to ignore stubbed classes in testing
- 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_name_format
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_name_format(taxon_name)
if !taxon_name.name.blank?
taxon_name.errors.add(:name, 'must be capitalized') unless taxon_name.name == taxon_name.name.capitalize
# TODO: this should be inherited/applied higher up?
- 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 sv_fix_coordinated_names_type_species_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_fix_coordinated_names_type_species_type
sttnr = self.type_taxon_name_relationship
return false if sttnr.nil?
fixed = false
list_of_coordinated_names.each do |t|
- 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 query_update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def query_update(params, response=nil)
begin
update!( params )
response.updated.push self.id if response
rescue ActiveRecord::RecordInvalid => e
- 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 is_stale_metadata
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_stale_metadata
case dwc_occurrence_object_type
when 'CollectionObject'
o = CollectionObject.select(:id, :updated_at, :collecting_event_id).find_by(id: dwc_occurrence_object_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"
Further reading
Method using_lsid_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def using_lsid_class
unless identifier.nil?
lsid = identifier.split(':')
# this is a test of http://rubular.com/regexes/13295
/SID=([\s\S]*?)LSID=([\s\S]*?)Auth=([\s\S]*)/ =~ identifier
- 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 sv_fix_coordinated_names_type_specimen
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sv_fix_coordinated_names_type_specimen
fixed = false
return false unless self.get_primary_type.empty?
list_of_coordinated_names.each do |t1|
types2 = t1.get_primary_type
- 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"