SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,628 of 12,628 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 default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

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

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

    async saveAssertedDistribution() {
      if (!this.isSaveAvailable) return

      const assertedDistribution = makeAssertedDistributionPayload({
        ad: this.assertedDistribution,

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_combination_relationship has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_fix_combination_relationship
    s = self.subject_taxon_name
    list = s.list_of_coordinated_names + [s]
    if s.rank_string =~ /Species/
      s_new = list.detect{|t| t.rank_class.rank_name == 'species'}
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 sv_fix_coordinated_names_original_species has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_original_species
      fixed = false
      return false unless self.original_species.nil?
      list_of_coordinated_names.each do |t|
        if !t.original_species.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_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_primary_types has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_primary_types
      if is_species_rank? && is_available?
        if self.type_materials.primary.empty? && self.type_materials.syntypes.empty?
          soft_validations.add(:base, 'Primary type is not selected')
        elsif self.type_materials.primary.count > 1 || (!self.type_materials.primary.empty? && !self.type_materials.syntypes.empty?)
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 sv_fix_add_synonym_for_homonym has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_fix_add_synonym_for_homonym
    if subject_taxon_name.iczn_set_as_synonym_of.nil?
      unless subject_taxon_name.iczn_replacement_names.empty?
        subject_taxon_name.iczn_set_as_synonym_of = object_taxon_name
        begin
Severity: Minor
Found in app/models/taxon_name_relationship/iczn/invalidating/homonym.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 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 sv_fix_coordinated_names_source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_source
      fixed = false
      pg = nil
      return false unless self.source.nil?
        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 sv_fix_coordinated_names_original_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_original_form
      fixed = false
      return false unless self.original_form.nil?
      list_of_coordinated_names.each do |t|
        if !t.original_form.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_genus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_type_genus
      fixed = false
      return false unless self.type_genus.nil?
      list_of_coordinated_names.each do |t|
        if !t.type_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 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 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_fix_coordinated_names_original_subgenus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_original_subgenus
      fixed = false
      return false unless self.original_subgenus.nil?
      list_of_coordinated_names.each do |t|
        if !t.original_subgenus.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_original_variety has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_original_variety
      fixed = false
      return false unless self.original_variety.nil?
      list_of_coordinated_names.each do |t|
        if !t.original_variety.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 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

Severity
Category
Status
Source
Language