SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

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

export default (state, material) => {
  const position = state.type_materials.findIndex(item => item.id === material.id)

  if (position < 0) {
    state.type_materials.push(material)
app/javascript/vue/tasks/loans/new/store/mutations/addLoanItem.js on lines 1..9
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

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

export default (state, value) => {
  const index = state.collection_objects.findIndex((item) => item.id === value.id)

  if (index >= 0) {
    state.collection_objects[index] = value
app/javascript/vue/tasks/digitize/store/mutations/Container/AddContainerItem.js on lines 1..10

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, material) => {
  const position = state.type_materials.findIndex(item => (item.id === material.id))

  if (position < 0) {
    state.type_materials.push(material)
app/javascript/vue/tasks/loans/new/store/mutations/addLoanItem.js on lines 1..9
app/javascript/vue/tasks/nomenclature/new_taxon_name/store/mutations/addCombination.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 2 locations. Consider refactoring.
Open

export default (state, value) => {
  const index = state.containerItems.findIndex((item) => item.id === value.id)

  if (index >= 0) {
    state.containerItems[index] = value
app/javascript/vue/tasks/digitize/store/mutations/CollectionObject/addCollectionObject.js on lines 1..10

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

Function makeInitialState has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makeInitialState () {
  return {
    taxon_name: {
      id: undefined,
      global_id: undefined,
Severity: Major
Found in app/javascript/vue/tasks/nomenclature/new_taxon_name/store/store.js - About 2 hrs to fix

    Method nexml_otus has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method remaining_taxa has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def remaining_taxa
          h = {}
          language = language_id.blank? ? nil : language_id.to_i
      
          row_hash.each do |r_key, r_value|
      Severity: Major
      Found in lib/tools/interactive_key.rb - About 2 hrs to fix

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

          def is_stale_metadata
            case dwc_occurrence_object_type
            when 'CollectionObject'
        
              o = CollectionObject.select(:id, :updated_at, :collecting_event_id).find_by(id: dwc_occurrence_object_id)
        Severity: Minor
        Found in app/models/dwc_occurrence.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. [34/25]
        Open

          def similar_labels
            retval = {}
            start_date = similar_params[:start_date]
            end_date = similar_params[:end_date]
            piece = similar_params[:piece]

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

            def build_descriptors
              @total_data_lines = 0
              i = 0
        
              # loop through rows

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

            def self.generate(taxon_name)
              ::CSV.generate(col_sep: "\t") do |csv|
        
                csv << %w{
                  global_id
        Severity: Minor
        Found in lib/export/basic_nomenclature.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. [34/25]
        Open

          def build_image_hash
            #    if !otu_filter.blank? || !row_filter.blank?
            #      img_ids = observation_depictions_from_otu_filter.pluck(:image_id).uniq
            #    else
            #      img_ids = observation_matrix.observation_depictions.pluck(:image_id).uniq
        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.

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

        const MutationFunctions = {
          [MutationNames.SetCollectionObject]: setCollectionObject,
          [MutationNames.SetIdentifier]: setIdentifier,
          [MutationNames.SetSledImage]: setSledImage,
          [MutationNames.SetImage]: setImage,
        app/javascript/vue/tasks/citations/otus/store/getters/getters.js on lines 23..33
        app/javascript/vue/tasks/type_specimens/store/actions/actions.js on lines 12..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 89.

        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 GetterFunctions = {
          [GetterNames.GetCitationSelected]: getCitationSelected,
          [GetterNames.GetCitationsList]: getCitationsList,
          [GetterNames.GetOtuCitationsList]: getOtuCitationsList,
          [GetterNames.GetOtuSelected]: getOtuSelected,
        app/javascript/vue/tasks/collection_objects/slide_breakdown/store/mutations/mutations.js on lines 23..33
        app/javascript/vue/tasks/type_specimens/store/actions/actions.js on lines 12..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 89.

        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 ActionFunctions = {
          [ActionNames.LoadTypeMaterial]: loadTypeMaterial,
          [ActionNames.LoadTypeMaterials]: loadTypeMaterials,
          [ActionNames.LoadTaxonName]: loadTaxonName,
          [ActionNames.LoadSoftValidations]: loadSoftValidations,
        app/javascript/vue/tasks/citations/otus/store/getters/getters.js on lines 23..33
        app/javascript/vue/tasks/collection_objects/slide_breakdown/store/mutations/mutations.js on lines 23..33

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

        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

        Function useStore has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useStore = () => {
          const actions = {
            requestTopics: async () => {
              state.isLoading = true
        
        
        Severity: Major
        Found in app/javascript/vue/tasks/content/publisher/composables/useStore.js - About 2 hrs to fix

          Class DwcOccurrence has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class DwcOccurrence < ApplicationRecord
            self.inheritance_column = nil
          
            include Housekeeping
          
          
          Severity: Minor
          Found in app/models/dwc_occurrence.rb - About 2 hrs to fix

            Class ImagesController has 24 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class ImagesController < ApplicationController
              include DataControllerConfiguration::ProjectDataControllerConfiguration
              after_action -> { set_pagination_headers(:images) }, only: [:index, :api_index, :api_image_inventory], if: :json_request?
            
              before_action :set_image, only: [:show, :edit, :update, :destroy, :rotate, :regenerate_derivative]
            Severity: Minor
            Found in app/controllers/images_controller.rb - About 2 hrs to fix

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

                def local_identifiers_facet
                  return nil if local_identifiers.nil?
                  a = nil
              
                  if local_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 229..257
              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 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 229..257
              lib/queries/concerns/identifiers.rb on lines 260..288

              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

              Severity
              Category
              Status
              Source
              Language