SpeciesFileGroup/taxonworks

View on GitHub

Showing 11,427 of 11,427 total issues

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

export default function ({ commit, state }, params = {}) {
  return new Promise((resolve, reject) => {
    state.settings.loadingColumns = true
    return GetMatrixObservationColumns(state.matrix.id, Object.assign({}, params, state.configParams)).then(response => {
      commit(MutationNames.SetMatrixColumns, response.body)
app/javascript/vue/tasks/new_matrix/store/actions/loadRowItems.js on lines 5..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 183.

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 collection_object.rb has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class CollectionObject < ApplicationRecord
  include GlobalID::Identification
  include Housekeeping

  include Shared::Citations
Severity: Minor
Found in app/models/collection_object.rb - About 7 hrs to fix

    Method build_dwca has 184 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def build_dwca
          line_counter = 1 # accounting for headers
    
          tasks = triage(csv.headers, tasks_)
          csv.each do |row|
    Severity: Major
    Found in lib/batch_load/import/dwca.rb - About 7 hrs to fix

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

        bind_position_handling_to_submit_button: function (form) {
          var base_class = form.data('base-class');
      
          form.closest('form').find('input[name="commit"]').click(function () {
            var i = 1;
      Severity: Major
      Found in app/assets/javascripts/views/people/_role_picker.js and 1 other location - About 7 hrs to fix
      app/assets/javascripts/views/topics/_topic_picker.js on lines 89..104

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

      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

        bind_position_handling_to_submit_button: function (form) {
          var base_class = form.data('base-class');
      
          form.closest("form").find('input[name="commit"]').click(function () {
            var i = 1;
      Severity: Major
      Found in app/assets/javascripts/views/topics/_topic_picker.js and 1 other location - About 7 hrs to fix
      app/assets/javascripts/views/people/_role_picker.js on lines 266..281

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

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

        def self.extract_dates(trial, match_data)
          end_date_year, end_date_month, end_date_day = 0, 0, 0
          case trial[:method].downcase.to_sym
            when :month_dd_yyyy_2
              start_date_year = 3
      Severity: Major
      Found in lib/utilities/dates.rb - About 7 hrs to fix

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

          methods: {
            removeFromList (id) {
              let position = this.list.findIndex(function (element) {
                return element.id == id
              })
        app/javascript/vue/components/radials/navigation/components/radialObjectExtend.js on lines 35..53

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

        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

          methods: {
            removeFromList (id) {
              let position = this.list.findIndex(function (element) {
                return element.id == id
              })
        app/javascript/vue/components/radials/object/components/annotatorExtend.js on lines 45..63

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

        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 GetterFunctions = {
          [GetterNames.GetFreeTextValueFor]: getFreeTextValueFor,
          [GetterNames.GetObservationsFor]: getObservationsFor,
          [GetterNames.GetContinuousValueFor]: getContinuousValueFor,
          [GetterNames.GetContinuousUnitFor]: getContinuousUnitFor,
        app/javascript/vue/tasks/images/new_image/store/getters/getters.js on lines 43..63

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

        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 GetterFunctions = {
          [GetterNames.GetAttributions]: getAttributions,
          [GetterNames.GetCitations]: getCitations,
          [GetterNames.GetCollectionObject]: getCollectionObject,
          [GetterNames.GetDataAttributes]: getDataAttributes,
        app/javascript/vue/tasks/matrix_row_coder/store/getters/getters.js on lines 43..63

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

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

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

          def sv_missing_original_publication
            if true #!self.cached_misspelling && !self.name_is_misapplied?
        
              if self.source.nil?
                soft_validations.add(:base, 'Original publication is not selected')
        Severity: Minor
        Found in app/models/taxon_name.rb - About 7 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 collection_objects_controller.rb has 461 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class CollectionObjectsController < ApplicationController
          include DataControllerConfiguration::ProjectDataControllerConfiguration
        
          before_action :set_collection_object, only: [
            :show, :edit, :update, :destroy, :navigation, :containerize,
        Severity: Minor
        Found in app/controllers/collection_objects_controller.rb - About 7 hrs to fix

          Class Query has 50 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 7 hrs to fix

            Function init has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
            Open

              init: function () {
                var soft_validations = undefined;
                function fillSoftValidation() {
                  if (soft_validations == undefined) {
                    if ($('[data-global-id]').length) {
            Severity: Minor
            Found in app/assets/javascripts/views/tasks/nomenclature/browse.js - About 6 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 2 locations. Consider refactoring.
            Open

            const GetterNames = {
              GetAllRanks: 'getAllRanks',
              ActiveModalStatus: 'activeModalStatus',
              ActiveModalType: 'activeModalType',
              ActiveModalRelationship: 'activeModalRelationship',
            app/javascript/vue/tasks/digitize/store/actions/actionNames.js on lines 1..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 173.

            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 ActionNames = {
              LoadContainer: 'loadContainer',
              GetTaxon: 'getTaxon',
              GetLabels: 'getLabels',
              GetIdentifier: 'getIdentifier',
            app/javascript/vue/tasks/nomenclature/new_taxon_name/store/getters/getters.js on lines 35..69

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

            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

                autocomplete_input.autocomplete({
                  source: '/keywords/lookup_keyword',
                  open: function (event, ui) {
                    TW.views.tags.tag_picker.bind_hover(form);
                  },
            Severity: Major
            Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/views/topics/_topic_picker.js on lines 38..53

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

            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

                autocomplete_input.autocomplete({
                  source: '/topics/lookup_topic',
                  open: function (event, ui) {
                    TW.views.topics.topic_picker.bind_hover(form);
                  },
            Severity: Major
            Found in app/assets/javascripts/views/topics/_topic_picker.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/views/tags/tag_picker.js on lines 39..55

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

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

                def self.coordinates_regex_from_verbatim_label(text)
                  return nil if text.blank?
                  text = ' ' + text + ' '
                  text.gsub("''", '"')
                      .gsub("´´", '"')
            Severity: Minor
            Found in lib/utilities/geo.rb - About 6 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

            Severity
            Category
            Status
            Source
            Language