SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

Method get_diffs_date has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_diffs_date version_new, version_old
    added_strings = []
    added_strings_indices = []
    deleted_strings = []
    deleted_strings_indices = []
Severity: Minor
Found in app/helpers/plugins/papertrail_helper.rb - About 1 hr to fix

    Method update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        klass = whitelist_constantize(params.require(:object_type))
        @object = klass.find(params[:object_id])
    
        if invalid_object(@object)
    Severity: Minor
    Found in app/controllers/papertrail_controller.rb - About 1 hr to fix

      Method predicate_data has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def predicate_data
            return @predicate_data if @predicate_data
      
            # if no predicate data found, return empty file
            if used_predicates.empty?
      Severity: Minor
      Found in lib/export/dwca/data.rb - About 1 hr to fix

        Method export_users has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.export_users(io, project)
            members = project.project_members.pluck(:user_id)
            conn = get_connection
        
            User.all.find_each do |user|
        Severity: Minor
        Found in lib/export/project_data/sql.rb - About 1 hr to fix

          Method save_selected has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def save_selected
              selected = params[:selected]
              next_id  = next_collecting_event_id
              if selected.blank?
                message = 'Nothing to save.'

            Method parse_iso_date_str has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.parse_iso_date_str(date_str)
            
                full_pattern = %r{^
                      (?<year>[0-9]{4})(-(?<month>[0-9]{1,2}))?(-(?<day>[0-9]{1,2}))?  # Date in these formats: YYYY | YYYY-M(M)? | YYYY-M(M)?-D(D)?
                      (
            Severity: Minor
            Found in lib/utilities/dates.rb - About 1 hr to fix

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

              export default function (state) {
                return ({ rowObjectId, rowObjectType }) => state.observations.filter(o => o.rowObjectId === rowObjectId && o.rowObjectType === rowObjectType)
              }
              app/javascript/vue/tasks/containers/new_container/store/container.js on lines 62..67

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

              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

                  getContainerItemByObject(state) {
                    return ({ objectId, objectType }) =>
                      state.containerItems.find(
                        (item) => item.objectId === objectId && item.objectType === objectType
                      )
              app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/getters/getObservationsFor.js on lines 1..3

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

              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

              $(document).on('turbolinks:load', function () {
                if ($('#model_index').length) {
                  TW.views.shared.recent_updates.init()
                }
              })
              Severity: Major
              Found in app/assets/javascripts/views/shared/recent_updates.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/views/hub/favorites.js on lines 17..21
              app/assets/javascripts/views/shared/lists.js on lines 169..173

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

              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

              $(document).on('turbolinks:load', function() {
                if ($("#main .tablesorter").length) {
                  TW.views.shared.list.init();
                }
              });
              Severity: Major
              Found in app/assets/javascripts/views/shared/lists.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/views/hub/favorites.js on lines 17..21
              app/assets/javascripts/views/shared/recent_updates.js on lines 60..64

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

              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

                  if (input_term.length == 0) {
                    form.find(".new_topic").attr("hidden", true);
                  }
                  else {
                    form.find(".new_topic").removeAttr("hidden");
              Severity: Major
              Found in app/assets/javascripts/views/citations/_topic_picker.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/views/people/_role_picker.js on lines 109..114

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

              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

                    if (input_term.length == 0) {
                      form.find(".new_person").attr("hidden", true);
                    }
                    else {
                      form.find(".new_person").removeAttr("hidden");
              Severity: Major
              Found in app/assets/javascripts/views/people/_role_picker.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/views/citations/_topic_picker.js on lines 41..46

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

              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

              $(document).on('turbolinks:load', function () {
                if ($("#favorite-page").length) {
                  TW.views.hub.favorites.init();
                }
              });
              Severity: Major
              Found in app/assets/javascripts/views/hub/favorites.js and 2 other locations - About 1 hr to fix
              app/assets/javascripts/views/shared/lists.js on lines 169..173
              app/assets/javascripts/views/shared/recent_updates.js on lines 60..64

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

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

              const URLParamsToJSON = function (query) {
                if (query.indexOf('?') < 0) return {}
                query = query.substring(query.indexOf('?') + 1)
              
                return qs.parse(query, {
              Severity: Minor
              Found in app/javascript/vue/helpers/url/parse.js - About 1 hr to fix

                Function default has 28 lines of code (exceeds 25 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}` }
                
                

                  Function makePayload has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function makePayload (observation) {
                    const payload = {
                      day_made: observation.day,
                      month_made: observation.month,
                      year_made: observation.year,

                    Function makePayload has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function makePayload(observation) {
                      const payload = {
                        day_made: observation.day,
                        month_made: observation.month,
                        year_made: observation.year,

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

                      function makeInitialState() {
                        return {
                          settings: {
                            importModalView: false,
                            isLoading: false,
                      Severity: Minor
                      Found in app/javascript/vue/tasks/dwca_import/store/store.js - About 1 hr to fix

                        Function processGeoreferenceQueue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async processGeoreferenceQueue(ceId) {
                              if (!ceId) return
                        
                              const unsaved = this.georeferences.filter((item) => item.isUnsaved)
                              const requests = unsaved.map((item) => {

                          Method roots_with_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def self.roots_with_data(project_id, load_root_otus = false)
                              # The updated_at subquery computes key_updated_at (and others), the second
                              # query uses that to compute key_updated_by (by finding which node has the
                              # corresponding key_updated_at).
                              # TODO: couplet_count will be wrong if any couplets don't have exactly two
                          Severity: Minor
                          Found in app/models/lead.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language