SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export default function minimumTimeoutPromise (promise, duration = 1) {
  const timeoutPromise = new Promise(resolve => {
    setTimeout(_ => {
      resolve(true)
    }, duration)
app/javascript/vue/tasks/observation_matrices/matrix_column_coder/helpers/minimumTimeoutPromise.js on lines 1..13

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export default function minimumTimeoutPromise (promise, duration = 1) {
  const timeoutPromise = new Promise(resolve => {
    setTimeout(_ => {
      resolve(true)
    }, duration)
app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/helpers/minimumTimeoutPromise.js on lines 1..13

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method build_collecting_events has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_collecting_events
      # DRMFieldNumbers DRMFN
      namespace_drm_field_numbers = Namespace.find_by(name: 'DRMFieldNumbers')

      @total_data_lines = 0
Severity: Major
Found in lib/batch_load/import/collecting_events/castor_interpreter.rb - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export default (list, nameList = []) => {
      for (var key in list) {
        if (typeof list[key] === 'object') {
          this.getRankNames(list[key], nameList)
        } else {
    app/javascript/vue/tasks/nomenclature/stats/helpers/getRankNames.js on lines 1..12

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export default (list, nameList = []) => {
      for (const key in list) {
        if (typeof list[key] === 'object') {
          this.getRankNames(list[key], nameList)
        } else {
    app/javascript/vue/tasks/observation_matrices/dashboard/helpers/getRankNames.js on lines 1..12

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method has too many lines. [36/25]
    Open

          def autocomplete
            #t = Time.now
            pr_id = project_id.join(',') if project_id.present?
    
            return [] if query_string.blank?

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    File pinboard.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var TW = TW || {}
    TW.workbench = TW.workbench || {}
    TW.workbench.pinboard = TW.workbench.pinboard || {}
    
    Object.assign(TW.workbench.pinboard, {
    Severity: Minor
    Found in app/assets/javascripts/workbench/pinboard.js - About 2 hrs to fix

      File identifiers.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Queries::Concerns::Identifiers
        include Queries::Helpers
      
        extend ActiveSupport::Concern
      
      
      Severity: Minor
      Found in lib/queries/concerns/identifiers.rb - About 2 hrs to fix

        Method set_cached_names_for_taxon_names has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def set_cached_names_for_taxon_names
            begin
              TaxonName.transaction_with_retry do
                t = taxon_name
        
        
        Severity: Major
        Found in app/models/taxon_name_classification.rb - About 2 hrs to fix

          Method sv_potential_family_homonyms has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_potential_family_homonyms
                if persisted? && is_family_rank? && is_available?
                  if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
                    if self.id == self.lowest_rank_coordinated_taxon.id
                      name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 2 hrs 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 descriptors_hash_initiate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def descriptors_hash_initiate
              h = {}
          
              # Depictions is depictions with other attributes added
              depictions = nil
          Severity: Minor
          Found in lib/tools/image_matrix.rb - About 2 hrs 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 citations_with_names has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def citations_with_names
                return @citations_with_names if !@citations_with_names.nil?
          
                d = Hash.new do |hash, key|
                  hash[key] = []
          Severity: Minor
          Found in lib/catalog/nomenclature/entry.rb - About 2 hrs 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

          File nexml_helper.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module ObservationMatrices::Export::NexmlHelper
          
            def nexml_descriptors(options = {})
              opt = {target: ''}.merge!(options)
              xml = Builder::XmlMarkup.new(target: opt[:target])
          Severity: Minor
          Found in app/helpers/observation_matrices/export/nexml_helper.rb - About 2 hrs to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export const verbatimProperties = {
              Datum: 'verbatim_datum',
              Label: 'verbatim_label',
              Locality: 'verbatim_locality',
              Latitude: 'verbatim_latitude',
            app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/verbatimProperties.js on lines 1..13

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 93.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export const verbatimProperties = {
              Datum: 'verbatim_datum',
              Label: 'verbatim_label',
              Locality: 'verbatim_locality',
              Latitude: 'verbatim_latitude',
            app/javascript/vue/components/Form/FormCollectingEvent/helpers/verbatimProperties.js on lines 1..13

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 93.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            const GetterNames = {
              GetCollectingEvent: 'getCollectingEvent',
              GetCollectionObject: 'getCollectionObject',
              GetContainer: 'getContainer',
              GetDepictions: 'getDepictions',
            app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/getters/getters.js on lines 20..38
            app/javascript/vue/tasks/type_specimens/store/getters/getters.js on lines 20..38

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 93.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            const GetterNames = {
              GetBiologicalId: 'getBiologicalId',
              GetCitation: 'getCitation',
              GetRoles: 'getRoles',
              GetTaxon: 'getTaxon',
            app/javascript/vue/tasks/collection_objects/browse/store/getters/getters.js on lines 19..37
            app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/getters/getters.js on lines 20..38

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 93.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            const GetterNames = {
              DoesRowObjectNeedCountdown: 'doesRowObjectNeedCountdown',
              GetCharacterStateChecked: 'getCharacterStateChecked',
              GetDescriptor: 'getDescriptor',
              GetDisplayUnscoredRows: 'getDisplayUnscoredRows',
            app/javascript/vue/tasks/collection_objects/browse/store/getters/getters.js on lines 19..37
            app/javascript/vue/tasks/type_specimens/store/getters/getters.js on lines 20..38

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 93.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method nexml_descriptors has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def nexml_descriptors(options = {})
                opt = {target: ''}.merge!(options)
                xml = Builder::XmlMarkup.new(target: opt[:target])
                m = opt[:observation_matrix]
                # Multistate characters
            Severity: Major
            Found in app/helpers/observation_matrices/export/nexml_helper.rb - About 2 hrs to fix

              Method build_da_for_otus has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def build_da_for_otus
                    @total_data_lines = 0
                    i = 0
                    import_klass = type_select.start_with?('im')
                    att_klass = (type_select.capitalize + 'Attribute').safe_constantize
              Severity: Major
              Found in lib/batch_load/import/otus/data_attributes_interpreter.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language