SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

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

const getters = {
  getPages: () => state.pagination,

  ghostCount: computed(() => {
    const countBuffered = state.labels.find(
app/javascript/vue/tasks/collecting_events/stepwise/collectors/composables/useStore.js on lines 121..131

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

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 (state, georeference) => {
  const index = state.queueGeoreferences.findIndex(item => item.tmpId === georeference.tmpId)

  if (index > -1) {
    state.queueGeoreferences[index] = georeference
app/javascript/vue/tasks/collecting_events/new_collecting_event/store/mutations/addGeoreference.js on lines 1..8

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

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 (state, georeference) => {
  const index = state.georeferences.findIndex(item => item.id === georeference.id)
  if (index > -1) {
    state.georeferences[index] = georeference
  } else {
app/javascript/vue/tasks/collecting_events/new_collecting_event/store/mutations/addGeoreferenceToQueue.js on lines 1..9

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

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 getters = {
  getPages: () => state.pagination,

  ghostCount: computed(() => {
    const countCollectors = state.verbatimCollectorFields.find(
app/javascript/vue/tasks/collection_objects/stepwise/determinations/composables/useStore.js on lines 119..129

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

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

Class SledImage has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class SledImage < ApplicationRecord
  include Housekeeping
  include Shared::Tags
  include Shared::Notes
  include Shared::IsData
Severity: Minor
Found in app/models/sled_image.rb - About 2 hrs to fix

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

      def descriptors_hash_initiate
        h = {}
    
        # Depictions is depictions with other attributes added
        depictions = nil
    Severity: Minor
    Found in lib/tools/image_matrix.rb by rubocop

    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. [35/25]
    Open

        def self.bibtex_from_citproc(c, b)
          return nil unless c.present? && b.present?
          c = JSON.parse(c)
    
          b[:address] = ::Utilities::Strings.encode_with_utf8(c['address']) unless c['address'].blank?
    Severity: Minor
    Found in lib/vendor/serrano.rb by rubocop

    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. [35/25]
    Open

      def descriptors_hash_initiate
        h = {}
    
        descriptors_with_keywords.each do |d|
          h[d.id] = {}
    Severity: Minor
    Found in lib/tools/interactive_key.rb by rubocop

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

      $.fn.mx_spinner = function(action) {
          if (!this.length) {   return this; }
          return this.each(function() {
            var target = $(this);
            var overlay =  target.data('mx_spinner');
    Severity: Major
    Found in app/assets/javascripts/vendor/lib/jquery/jquery.mx-spinner.js - About 2 hrs to fix

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

      export const DataAttribute = {
        ...baseCRUD(controller, permitParams),
      
        createBatch: (params) =>
          ajaxCall('post', `/${controller}/batch_create`, params),
      Severity: Major
      Found in app/javascript/vue/routes/endpoints/DataAttribute.js and 1 other location - About 2 hrs to fix
      app/javascript/vue/routes/endpoints/LoanItem.js on lines 20..30

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

      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 const LoanItem = {
        ...baseCRUD(controller, permitParams),
      
        createBatch: (params) =>
          AjaxCall('post', `/${controller}/batch_create`, params),
      Severity: Major
      Found in app/javascript/vue/routes/endpoints/LoanItem.js and 1 other location - About 2 hrs to fix
      app/javascript/vue/routes/endpoints/DataAttribute.js on lines 17..27

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

      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

      function getDataAttributesFor(data, objectId) {
        const list = data.data.filter(([id]) => id === objectId)
        const headers = makeDataAttributeObjectHeaders(data)
      
        return Object.assign(
      app/javascript/vue/tasks/collecting_events/filter/utils/listParser.js on lines 8..18

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

      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

      function getDataAttributesFor(data, objectId) {
        const list = data.data.filter(([id]) => id === objectId)
        const headers = makeDataAttributeObjectHeaders(data)
      
        return Object.assign(
      app/javascript/vue/tasks/nomenclature/filter/utils/listParser.js on lines 7..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 91.

      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

          return GetMatrixObservationRows(
            state.matrix.id,
            Object.assign({}, params, state.configParams, {
              extend: ['observation_object']
            })
      app/javascript/vue/tasks/observation_matrices/new/store/actions/loadColumnItems.js on lines 8..22

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

      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

          return GetMatrixObservationColumns(
            state.matrix.id,
            Object.assign({}, params, state.configParams)
          ).then(
            (response) => {
      app/javascript/vue/tasks/observation_matrices/new/store/actions/loadRowItems.js on lines 8..24

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

      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

      File filter.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Queries
        module Person
      
          class Filter < Query::Filter
            include Queries::Concerns::DataAttributes
      Severity: Minor
      Found in lib/queries/person/filter.rb - About 2 hrs to fix

        Method build_sequence_relationships has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_sequence_relationships
              @total_data_lines = 0
              i = 0
              gene_descriptors = {}
              gene_attributes = {}
        Severity: Minor
        Found in lib/batch_load/import/sequence_relationships/primers_interpreter.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 a Cognitive Complexity of 20 (exceeds 5 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: Minor
        Found in lib/export/coldp/files/taxon.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

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

        export default (state, loan_item) => {
          const position = state.loan_items.findIndex(item => item.id === loan_item.id)
        
          if (position < 0) {
            state.loan_items.push(loan_item)
        app/javascript/vue/tasks/nomenclature/new_taxon_name/store/mutations/addCombination.js on lines 1..9
        app/javascript/vue/tasks/observation_matrices/new/store/mutations/addTypeMaterial.js on lines 1..9
        app/javascript/vue/tasks/type_specimens/store/mutations/addTypeMaterial.js on lines 1..9

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

        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

        export default (state, combination) => {
          const index = state.combinations.findIndex(item => item.id === combination.id)
        
          if (index < 0) {
            state.combinations.push(combination)
        app/javascript/vue/tasks/loans/new/store/mutations/addLoanItem.js on lines 1..9
        app/javascript/vue/tasks/observation_matrices/new/store/mutations/addTypeMaterial.js on lines 1..9
        app/javascript/vue/tasks/type_specimens/store/mutations/addTypeMaterial.js on lines 1..9

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

        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