SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

Function resizeTaskCarrousel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  resizeTaskCarrousel() {
    const userWindowWidth = window.innerWidth
    const userWindowHeight = window.innerHeight
    const isFavouritePage = !!document.querySelector('#favorite-page')
    const taskSection = document.querySelector('.task-section')
Severity: Minor
Found in app/assets/javascripts/views/hub/filter.js - About 1 hr 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 shortcutsListener has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    shortcutsListener(e) {
      const key = e.key.toLowerCase()
      const titles = this.shortcutList[key]
      const activeElement = document.activeElement.tagName

Severity: Minor
Found in app/javascript/vue/components/radials/mixins/shortcuts.js - About 1 hr 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 openSlideoutPanel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  openSlideoutPanel: function (panel) {
    if ($(panel).hasClass('slide-left')) {
      $(panel).css('right', '')
      if ($(panel).css('left') != '0px') {
        if ($(panel).attr('data-panel-position') == 'relative') {
Severity: Minor
Found in app/assets/javascripts/views/shared/slideout.js - About 1 hr 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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_family_is_invalid
      if persisted? && is_family_rank? && is_available?
        tg = type_genus
        if tg && (!TaxonNameRelationship.where_subject_is_taxon_name(tg).homonym_or_suppressed.empty? ||
            !TaxonNameClassification.where_taxon_name(tg).with_type_string('TaxonNameClassification::Iczn::Available::Invalid::Homonym').empty? )
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr 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 form_of_uri has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def form_of_uri
    if uri.present?

      uris = URI.extract(uri)

Severity: Minor
Found in app/models/controlled_vocabulary_term.rb - About 1 hr 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 always_community? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def always_community?

      case self.class.base_class.name
      when 'AlternateValue'
        if self.alternate_value_object_type =~ /#{self.class::ALWAYS_COMMUNITY.join('|')}/
Severity: Minor
Found in app/models/concerns/shared/dual_annotator.rb - About 1 hr 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 convertable_to_combination? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def convertable_to_combination?
    a = nil
    return false unless a = becomes_test_for_relationship
    return false unless becomes_test_for_similarity(a)
    return false unless becomes_test_for_original_genus
Severity: Minor
Found in app/models/protonym/becomes.rb - About 1 hr 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_repository has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_primary_types_repository
      if is_species_rank?
        s = self.type_materials
        unless s.empty?
          s.primary.each do |t|
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr 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_missing_etymology has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def sv_missing_etymology
      if self.etymology.nil? && self.rank_string =~ /(Genus|Species)/ && is_available?
        z = TaxonName.
            where(name: name, project_id: project_id).where.not(etymology: nil).
            group(:etymology).
Severity: Minor
Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr 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 sqed_waxy_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def sqed_waxy_metadata(sqed_depiction)
    o = sqed_depiction.depiction_object
    [
      (o.identifiers.local.any? ? 1 : 0),
      (o.buffered_collecting_event.blank? ? 0 : 1),
Severity: Minor
Found in app/helpers/sqed_depictions_helper.rb - About 1 hr 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 make_dates_matching_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def make_dates_matching_table(*pieces, collection)  # rubocop:disable Metrics/MethodLength
    columns = ['CEID', 'Match', 'Start Date', 'End Date', 'Verbatim Date', 'Select']

    thead = content_tag(:thead) do
      content_tag(:tr) do
Severity: Minor
Found in app/helpers/tasks/collecting_events/parse/stepwise/dates_helper.rb - About 1 hr 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 recursive_catalog_json has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def recursive_catalog_json(taxon_name: nil, target_depth: 0, depth: 0, data: { timeline: [], sources: [], repositories: []} )
      return data if taxon_name.nil?

      cat = ::Catalog::Nomenclature::Entry.new(taxon_name)
      data[:sources] += [cat.sources].flatten
Severity: Minor
Found in app/helpers/taxon_names/json_catalog_helper.rb - About 1 hr 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 source_citation_totals has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def source_citation_totals(sources)
    data = {}
    max_total = 0

    Citation.related_klasses.each do |k|
Severity: Minor
Found in app/helpers/sources_helper.rb - About 1 hr 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 observations_cell_label has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def observations_cell_label(observations_hash, descriptor, hash_index, style = :tnt)

    case observations_hash[descriptor.id][hash_index].size
    when 0
      '?'
Severity: Minor
Found in app/helpers/observation_matrices_helper.rb - About 1 hr 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 type_material_catalog_label has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def type_material_catalog_label(type_material, verbose = false) # Possibly parameterize biocurations: true, repository: true, identifiers: true
    t = type_material

    if t.nil? && verbose # Anticipate rendering in paper
      return '[TODO: Add type material]'
Severity: Minor
Found in app/helpers/type_materials/catalog_helper.rb - About 1 hr 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 attribute_clauses has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def attribute_clauses
    c = []
    self.class::ATTRIBUTES.each do |a|
      if any_value_attribute.include?(a)
        c.push table[a].not_eq(nil)
Severity: Minor
Found in lib/queries/concerns/attributes.rb - About 1 hr 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 permitted_params has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def permitted_params(hsh)
      h = self.class::PARAMS.deep_dup
      h.unshift(:per)
      h.unshift(:page)
      h.unshift(:paginate)
Severity: Minor
Found in lib/queries/query/filter.rb - About 1 hr 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 process_result has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def process_result(use_thumbnail: true)
      begin
        sqed.use_thumbnail = use_thumbnail
        r = sqed.result
      rescue Sqed::Error
Severity: Minor
Found in lib/vendor/sqed_to_taxonworks.rb - About 1 hr 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 autocomplete has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def autocomplete
        #t = Time.now
        pr_id = project_id.join(',') if project_id.present?

        return [] if query_string.blank?
Severity: Minor
Found in lib/queries/geographic_area/autocomplete.rb - About 1 hr 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 useBiocurationGroup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function useBiocurationGroup(groupId) {
  const biologicalGroupClasses = ref([])

  Tag.where({ keyword_id: groupId }).then(({ body }) => {
    biologicalGroupClasses.value = body
    Severity
    Category
    Status
    Source
    Language