SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,625 of 12,625 total issues

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

export default {
  components: { LockComponent },

  computed: {
    lock: {
app/javascript/vue/tasks/collection_objects/freeform_digitize/components/shared/lock.js on lines 6..19

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

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

    createBiocurationGroup: (controlled_vocabulary_term) => {
      ControlledVocabularyTerm.create({ controlled_vocabulary_term }).then(
        ({ body }) => {
          state.biocurationGroups.push(body)
          TW.workbench.alert.create(
app/javascript/vue/tasks/controlled_vocabularies/biocurations/composables/useStore.js on lines 27..37

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

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

    createBiocurationClass: (controlled_vocabulary_term) => {
      ControlledVocabularyTerm.create({ controlled_vocabulary_term }).then(
        ({ body }) => {
          state.biocurationClasses.push(body)
          TW.workbench.alert.create(
app/javascript/vue/tasks/controlled_vocabularies/biocurations/composables/useStore.js on lines 39..49

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

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 {
  components: { LockComponent },

  computed: {
    lock: {
app/javascript/vue/tasks/collection_objects/slide_breakdown/components/shared/lock.js on lines 6..19

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

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

  def initialize(params = {})
    super

    self.is_median_z    = false
    self.is_undefined_z = false # and delta_z is zero, or ignored

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

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

    if t.nil? && verbose # Anticipate rendering in paper
      return '[TODO: Add type material]'

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

  def update
    next_id = next_collecting_event_id
    ce = current_collecting_event
    any_failed = false
    

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

    def autocomplete
      t = Time.now
      return [] if query_string.blank?
      queries = [
        [autocomplete_exact_id, nil ],

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

        def get_tw_geographic_area(row, logger, sf_geo_level4_hash)

          tw_area = nil
          l1, l2, l3, l4 = row['Level1ID'], row['Level2ID'], row['Level3ID'], row['Level4ID']
          l1 = '' if l1 == '0'

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

  def using_isbn_class
    unless identifier.nil?
      isbn = identifier.upcase
      # 'ISBN-13: 978-0-596-52068-7'
      isbn.gsub!('ISBN-10', '')
Severity: Major
Found in app/models/identifier/global/isbn.rb - About 2 hrs to fix

    Method all_sub_headers has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def all_sub_headers(filtered = false)
        unless filtered
          ce_headers # generate the header structure (see CollectionObject.selected_column_names)
          co_headers
          bc_headers
    Severity: Major
    Found in app/helpers/tasks/gis/report_helper.rb - About 2 hrs to fix

      Method taxonworks_extension_data has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def taxonworks_extension_data
            return @taxonworks_extension_data if @taxonworks_extension_data
      
            # hash of internal method name => csv header name
            methods = {}
      Severity: Major
      Found in lib/export/dwca/data.rb - About 2 hrs to fix

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

            Project.class_eval do
              store :preferences, accessors: BASE_PREFERENCES.symbolize_keys.keys, coder: JSON
              before_save :fill_preferences 
        
          # after_initialize :set_default_preferences
        Severity: Major
        Found in app/models/project/preferences.rb and 1 other location - About 2 hrs to fix
        app/models/user/preferences.rb on lines 6..19

        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

            User.class_eval do
              store :preferences, accessors: BASE_PREFERENCES.symbolize_keys.keys, coder: JSON
              before_save :fill_preferences
        
              def self.hash_preferences
        Severity: Major
        Found in app/models/user/preferences.rb and 1 other location - About 2 hrs to fix
        app/models/project/preferences.rb on lines 11..26

        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

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

        export default (state) => {
          const { preferences, project_preferences } = state
        
          history.replaceState(null, null, '/tasks/accessions/comprehensive')
          state = Object.assign(state, makeInitialState())
        app/javascript/vue/tasks/digitize/store/actions/resetStore.js on lines 9..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 82.

        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 ({ state }) => {
          const { preferences, project_preferences } = state
        
          history.replaceState(null, null, '/tasks/accessions/comprehensive')
          state = Object.assign(state, makeInitialState())
        app/javascript/vue/tasks/digitize/store/mutations/resetStore.js on lines 9..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 82.

        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 PeopleController has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class PeopleController < ApplicationController
          include DataControllerConfiguration::SharedDataControllerConfiguration
        
          before_action :set_person, only: [:show, :edit, :update, :destroy, :roles, :similar, :api_show]
          after_action -> { set_pagination_headers(:people) }, only: [:index, :api_index], if: :json_request?
        Severity: Minor
        Found in app/controllers/people_controller.rb - About 2 hrs to fix

          Class ObservationMatrixColumnItem has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

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

            Class Query has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Query
                include Arel::Nodes
            
                include Queries::Concerns::Identifiers
            
            
            Severity: Minor
            Found in lib/queries/query.rb - About 2 hrs to fix

              Class Tabular has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Tabular < Query::Autocomplete
              
                    include Queries::Helpers
              
                    # @return [Integer]
              Severity: Minor
              Found in lib/queries/taxon_name/tabular.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language