SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,625 of 12,625 total issues

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

  def global_identifiers_facet
    return nil if global_identifiers.nil?
    a = nil

    if global_identifiers
Severity: Major
Found in lib/queries/concerns/identifiers.rb and 2 other locations - About 2 hrs to fix
lib/queries/concerns/identifiers.rb on lines 260..288
lib/queries/concerns/identifiers.rb on lines 292..320

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 97.

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

const MutationNames = {
  AddCitation: 'addCitation',
  AddToOtuList: 'addToOtuList',
  AddTopicSelected: 'addTopicSelected',
  AddToSourceList: 'addToSourceList',
app/javascript/vue/tasks/otu/browse/store/mutations/mutations.js on lines 18..35

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 88.

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

const MutationNames = {
  SetBiologicalAssociations: 'setBiologicalAssociations',
  SetCollectingEvents: 'setCollectingEvents',
  SetCollectionObjects: 'setCollectionObjects',
  SetCommonNames: 'setCommonNames',
app/javascript/vue/tasks/citations/otus/store/mutations/mutations.js on lines 18..35

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 88.

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 add_original_combination has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.add_original_combination(t, csv, origin_citation, name_remarks_vocab_id, project_members)
    e = t.original_combination_elements

    infraspecific_element = t.original_combination_infraspecific_element(e, remove_sic: true)

Severity: Major
Found in lib/export/coldp/files/name.rb - About 2 hrs to fix

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

      def collection_object_params
        params.require(:collection_object).permit(
          :total, :preparation_type_id, :repository_id, :current_repository_id,
          :ranged_lot_category_id, :collecting_event_id,
          :buffered_collecting_event, :buffered_determinations,

    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.

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

        def build_protonyms
          if name_collection.nil?
            @file_errors.push 'No names were readable in the file.'
            return
          end

    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.

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

    export default function (state, observation) {
      if (!observation.type) { throw `Observations must have a type!` }
    
      if (Object.keys(ObservationTypes).findIndex(typeKey => ObservationTypes[typeKey] === observation.type) === -1) { throw `Observations must have a valid type! Given ${observation.type}` }
    
    

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

      def is_in_use?(exclude = [], only = [])
        if only.empty?
          self.class.reflect_on_all_associations(:has_many).each do |r|
            next if exclude.include?(r.name)
            return true if self.send(r.name).count(:all) > 0
    Severity: Minor
    Found in app/models/concerns/shared/is_data.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 make_lat_long_matching_table has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def make_lat_long_matching_table(*pieces, collection)
        columns = ['CEID', 'Match', 'Verbatim Lat', 'Verbatim Long',
                   'Decimal lat', 'Decimal long', 'Is georeferenced?', 'Select']
    
        thead = content_tag(:thead) do
    Severity: Minor
    Found in app/helpers/tasks/collecting_events/parse/stepwise/lat_long_helper.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 build_asserted_distributions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_asserted_distributions
          i = 1
          csv.each do |row|
            i += 1
    
    
    Severity: Minor
    Found in lib/batch_load/import/asserted_distributions.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 otu has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def otu(columns)
          r = BatchLoad::ColumnResolver::Result.new
    
          if columns['otu_id']
            begin
    Severity: Minor
    Found in lib/batch_load/column_resolver.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 autocomplete has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

          def autocomplete
            return [] if query_string.blank? || project_id.empty?
    
            queries = [
              [ autocomplete_exact_id, false ],
    Severity: Minor
    Found in lib/queries/person/autocomplete.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 generate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.generate(otus, project_members, root_otu_id = nil, reference_csv = nil, prefer_unlabelled_otus: true)
    
        # Until we have RC5 articulations we are simplifying handling the fact
        # that one taxon name can be used for many OTUs. Track to see that
        # an OTU with a given taxon name does not already exist
    Severity: Major
    Found in lib/export/coldp/files/taxon.rb - About 2 hrs to fix

      Method build_sequences has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def build_sequences
            @total_data_lines = 0;
      
            sequences = {}
            sequence_values = {}
      Severity: Major
      Found in lib/batch_load/import/sequences/primers_interpreter.rb - About 2 hrs to fix

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

        const ComponentNamesToObservations = {
          [ComponentNames.Qualitative]: ObservationTypes.Qualitative,
          [ComponentNames.Continuous]: ObservationTypes.Continuous,
          [ComponentNames.Sample]: ObservationTypes.Sample,
          [ComponentNames.Presence]: ObservationTypes.Presence,
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/loadColumn.js on lines 29..36
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/requestMatrixRow.js on lines 53..60
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/helpers/makeEmptyObservationsFor.js on lines 5..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 86.

        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 4 locations. Consider refactoring.
        Open

        const DescriptorTypesToComponentNames = {
          [DescriptorTypes.FreeText]: ComponentNames.FreeText,
          [DescriptorTypes.Media]: ComponentNames.Media,
          [DescriptorTypes.Qualitative]: ComponentNames.Qualitative,
          [DescriptorTypes.Continuous]: ComponentNames.Continuous,
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/helpers/makeEmptyObservationsFor.js on lines 5..12
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/requestMatrixRow.js on lines 53..60
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/helpers/makeEmptyObservationsFor.js on lines 5..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 86.

        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

          props: {
            type: {
              type: String,
              required: true
            },
        app/javascript/vue/components/radials/annotator/components/annotatorExtend.js on lines 2..23

        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 86.

        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 4 locations. Consider refactoring.
        Open

        const DescriptorTypesToComponentNames = {
          [DescriptorTypes.FreeText]: ComponentNames.FreeText,
          [DescriptorTypes.Media]: ComponentNames.Media,
          [DescriptorTypes.Qualitative]: ComponentNames.Qualitative,
          [DescriptorTypes.Continuous]: ComponentNames.Continuous,
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/helpers/makeEmptyObservationsFor.js on lines 5..12
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/loadColumn.js on lines 29..36
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/helpers/makeEmptyObservationsFor.js on lines 5..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 86.

        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 4 locations. Consider refactoring.
        Open

        const ComponentNamesToObservations = {
          [ComponentNames.Qualitative]: ObservationTypes.Qualitative,
          [ComponentNames.Continuous]: ObservationTypes.Continuous,
          [ComponentNames.Sample]: ObservationTypes.Sample,
          [ComponentNames.Presence]: ObservationTypes.Presence,
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/helpers/makeEmptyObservationsFor.js on lines 5..12
        app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/loadColumn.js on lines 29..36
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/requestMatrixRow.js on lines 53..60

        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 86.

        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

        export const ID_PARAM_FOR = {
          [ASSERTED_DISTRIBUTION]: 'asserted_distribution_id',
          [BIOLOGICAL_ASSOCIATION]: 'biological_association_id',
          [COLLECTING_EVENT]: 'collecting_event_id',
          [COLLECTION_OBJECT]: 'collection_object_id',
        app/javascript/vue/components/radials/filter/constants/queryParam.js on lines 19..35
        app/javascript/vue/tasks/loans/filter/constants/attributes.js on lines 1..17

        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 86.

        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

        Severity
        Category
        Status
        Source
        Language