SpeciesFileGroup/taxonworks

View on GitHub

Showing 732 of 12,572 total issues

Function default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function ({ commit, state }, args) {
  const observation = getObservationFromArgs(state, args)

  if (observation?.id) { return Promise.resolve() }

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

Function removeEmptyProperties has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function removeEmptyProperties(object) {
  const obj = { ...object }

  for (const key in obj) {
    const value = obj[key]
Severity: Minor
Found in app/javascript/vue/helpers/objects.js - About 35 mins 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

Function default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function ({ dispatch, state, commit }, { rowObjectId, rowObjectType }) {
  const observations = state.observations.filter(o => o.isUnsaved)

  return Promise.all(observations.map(o => {
    if (isQualitativeObservation(o)) {

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?
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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|
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 using_orcid_class has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def using_orcid_class
    unless identifier.nil?
      orcid = identifier.upcase

      /^(?<preamble>http[s]?:\/\/){0,1}(?<domain>orcid\.org\/){1}(?<part_1>\d{4})-(?<part_2>\d{4})-(?<part_3>\d{4})-(?<part_4>\d{3})(?<last>.)$/i =~ orcid
Severity: Minor
Found in app/models/identifier/global/orcid.rb - About 35 mins 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 is_metadata_depiction? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def is_metadata_depiction?
    if depiction_params && !depiction_params.empty?
      a = depiction_params[:is_metadata_depiction]
      ((a == 'true') || (a == true)) ? true : false
    else
Severity: Minor
Found in app/models/sled_image.rb - About 35 mins 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 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?
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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
Severity: Minor
Found in app/models/taxon_name_relationship.rb - About 35 mins 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 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?
Severity: Minor
Found in app/models/nomenclatural_rank/icn/higher_classification_group.rb - About 35 mins 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 some_roles_present has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def some_roles_present
    ATTRIBUTION_ROLES.each do |r|
      return true if send("#{r}_roles".to_sym).any?
    end

Severity: Minor
Found in app/models/attribution.rb - About 35 mins 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 set_dwc_occurrence has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_dwc_occurrence
    retried = false
    begin
      if dwc_occurrence_persisted?
        dwc_occurrence.generate_uuid_if_required # TODO: at some point when syncronized make this optional
Severity: Minor
Found in app/models/concerns/shared/is_dwc_occurrence.rb - About 35 mins 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 validate_name_format has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.validate_name_format(taxon_name)
    taxon_name.errors.add(:name, 'name must be capitalized') unless  !taxon_name.name.blank? && taxon_name.name == taxon_name.name.capitalize
    taxon_name.errors.add(:name, 'name must be at least two letters') unless taxon_name.name.length > 1
    taxon_name.errors.add(:name, 'name must not end in -virus') if (taxon_name.name =~ /.*virus\Z/) && taxon_name.name.length > 1
  end
Severity: Minor
Found in app/models/nomenclatural_rank/icn/genus_group.rb - About 35 mins 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 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
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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
Severity: Minor
Found in app/models/observation.rb - About 35 mins 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 sv_validate_coordinated_names_source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_validate_coordinated_names_source
      return true unless is_valid?
      s = self.source
      list_of_coordinated_names.each do |t|
        if ((s && t.source && s.id != t.source.id) || (s.nil? && t.source))
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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')
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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
Severity: Minor
Found in app/models/project.rb - About 35 mins 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 sv_fix_coordinated_names_etymology has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_etymology
      fixed = false
      return false unless self.etymology.blank?
      list_of_coordinated_names.each do |t|
        if !t.etymology.blank?
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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 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
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins 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

Severity
Category
Status
Source
Language