SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,628 of 12,628 total issues

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

export default async function(id_or_couplet) {
  let lo = undefined
  let error_message = undefined
  if (typeof(id_or_couplet) == 'object') {
    lo = id_or_couplet
Severity: Minor
Found in app/javascript/vue/tasks/leads/new_lead/store/actions/loadKey.js - About 45 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 filterKeys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    CarrouselData.prototype.filterKeys = function(handleKey) {
        for(var i = 0; i <= this.children; i++) {            
            child = $('.data_section[data-section="' + this.sectionTag + '"] > .cards-section > .card-container:nth-child('+ (i) +')');
            if(this.checkChildFilter(child.children().children(".filter_data"))) {
                if($(child).text().toLowerCase().indexOf(handleKey.toLowerCase()) > 0 || handleKey == "") {
Severity: Minor
Found in app/assets/javascripts/views/hub/cards-filter.js - About 45 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_original_combination_relationships has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_original_combination_relationships
      relationships = self.original_combination_relationships
      unless relationships.empty?
        relationships = relationships.sort_by{|r| r.type_class.order_index }
        ids = relationships.collect{|r| r.subject_taxon_name_id}
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 45 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_synonym_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_synonym_relationship
    if self.source
      date1 = self.source.cached_nomenclature_date.to_time
      date2 = self.subject_taxon_name.cached_nomenclature_date
      if !!date1 && !!date2
Severity: Minor
Found in app/models/taxon_name_relationship/icnp/unaccepting/synonym.rb - About 45 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_priority has a Cognitive Complexity of 8 (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 && date2 > date1 && subject_invalid_statuses.empty?
Severity: Minor
Found in app/models/taxon_name_relationship/iczn.rb - About 45 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_gender has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_gender
      return false unless self.gender_class.nil?
      list_of_coordinated_names.each do |t|
        unless t.gender_class.nil?
          c = self.taxon_name_classifications.create(type: t.gender_class.to_s)
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 45 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_synonym_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_synonym_relationship
    if self.source
      date1 = self.source.cached_nomenclature_date.to_time
      date2 = self.subject_taxon_name.cached_nomenclature_date
      if !!date1 && !!date2
Severity: Minor
Found in app/models/taxon_name_relationship/icn/unaccepting/synonym.rb - About 45 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_synonym_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_synonym_relationship
    if self.source
      date1 = self.source.cached_nomenclature_date.to_time
      date2 = self.subject_taxon_name.cached_nomenclature_date
      if !!date1 && !!date2
Severity: Minor
Found in app/models/taxon_name_relationship/typification/genus/subsequent.rb - About 45 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_synonym_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_synonym_relationship
    if self.source
      date1 = self.source.cached_nomenclature_date.to_time
      date2 = self.subject_taxon_name.cached_nomenclature_date
      if !!date1 && !!date2
Severity: Minor
Found in app/models/taxon_name_relationship/iczn/invalidating/synonym.rb - About 45 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_not_specific_relationship has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_fix_not_specific_relationship
    s = self.subject_taxon_name
    o = self.object_taxon_name
    subject_type = s.type_taxon_name
    object_type = o.type_taxon_name
Severity: Minor
Found in app/models/taxon_name_relationship/iczn/invalidating/synonym.rb - About 45 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_part_of_speech has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_part_of_speech
      return false unless self.part_of_speech_class.nil?
      list_of_coordinated_names.each do |t|
        unless t.part_of_speech_class.nil?
          c = self.taxon_name_classifications.create(type: t.part_of_speech_class.to_s)
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 45 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_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_page
      fixed = false
      return false if self.origin_citation.nil? || !self.origin_citation.pages.nil?
      list_of_coordinated_names.each do |t|
        if !t.origin_citation.nil? && !t.origin_citation.pages.nil? && self.origin_citation.source_id == t.origin_citation.source_id
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 45 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_single_primary_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sv_single_primary_type
    primary_types = TypeMaterial.with_type_array(['holotype', 'neotype', 'lectotype']).where_protonym(protonym).not_self(self)
    syntypes = TypeMaterial.with_type_array(['syntype', 'syntypes']).where_protonym(protonym)

    if type_type =~ /syntype/
Severity: Minor
Found in app/models/type_material.rb - About 45 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_fix_coordinated_names_type_species
      fixed = false
      tr = nil
      return false unless self.type_species.nil?
      list_of_coordinated_names.each do |t|
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 45 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

Avoid deeply nested control flow statements.
Open

              if neuter_name.blank?
                soft_validations.add(:neuter_name, "The species name is marked as #{part_of_speech_name}, but the name spelling in neuter is not provided")
              else
                # e = species_questionable_ending(TaxonNameClassification::Latinized::Gender::Neuter, neuter_name)
                # soft_validations.add(:neuter_name, "Name has a non neuter ending: -#{e}") unless e.nil?
Severity: Major
Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} should be a homonym or duplicate of #{s.cached_html_name_and_author_year}") if s.nomenclatural_code == self.nomenclatural_code
    Severity: Major
    Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

      Method containerize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.containerize(objects, klass = Container::Virtual)
          new_container = nil
          begin
            Container.transaction do
              new_container = klass.create()
      Severity: Minor
      Found in app/models/container.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                    if masculine_name.blank?
                      soft_validations.add(:masculine_name, "The species name is marked as #{part_of_speech_name}, but the name spelling in masculine is not provided")
                    else
                      # e = species_questionable_ending(TaxonNameClassification::Latinized::Gender::Masculine, masculine_name)
                      # soft_validations.add(:masculine_name, "Name has a non masculine ending: -#{e}") unless e.nil?
      Severity: Major
      Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      possible_primary_homonyms_alternative_spelling = name2 ? Protonym.with_primary_homonym_alternative_spelling(name2).without_homonym_or_suppressed.without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).not_self(self).with_base_of_rank_class('NomenclaturalRank::Iczn::SpeciesGroup').with_project(self.project_id) : []
        Severity: Major
        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if !list2.empty?
                          list2.each do |s|
                            soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} could be a primary homonym of #{s.cached_html_name_and_author_year} (alternative spelling)")
                          end
                        else
          Severity: Major
          Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language