SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

Method set_cached_names_for_taxon_names has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_cached_names_for_taxon_names
    # !! only fire if subject_taxon_name changed
    return true unless subject_taxon_name_id_previously_changed? || destroyed?

    TaxonName.transaction do
Severity: Minor
Found in app/models/taxon_name_relationship.rb - About 1 hr to fix

    Method sv_fix_objective_synonym_relationship has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def sv_fix_objective_synonym_relationship
        fixed = false
        s = self.subject_taxon_name
        o = self.object_taxon_name
        if s.get_primary_type.empty?

      Method using_iccn_class has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def using_iccn_class
          unless identifier.nil?
            lccn = identifier
      
            # '200112345', '2010549727', '2003064850', '|a  2003064850', '88156495', '68-004897', '2001-459440'
      Severity: Minor
      Found in app/models/identifier/global/lccn.rb - About 1 hr to fix

        Method include_multistate_matrix has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def include_multistate_matrix(options = {})
            opt = {target: '', descriptors: []}.merge!(options)
            xml = Builder::XmlMarkup.new(target: opt[:target])
        
            m = opt[:observation_matrix]
        Severity: Minor
        Found in app/helpers/observation_matrices/export/nexml_helper.rb - About 1 hr to fix

          Method dwc_occurrences_metadata has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def dwc_occurrences_metadata(dwc_occurrences = nil, project_id: nil)
              records = dwc_occurrences
              project_id ||= sessions_current_project_id
          
              # Anticipate multiple sources of records in future (e.g. AssertedDistribution)
          Severity: Minor
          Found in app/helpers/dwc_occurrences_helper.rb - About 1 hr to fix

            Method add_scopes_to_routes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def add_scopes_to_routes
                scopes = ['scope :tasks']
                scope_index = 0
            
                @paths.each do |path|
            Severity: Minor
            Found in lib/generators/taxon_works/task/task_generator.rb - About 1 hr to fix

              Method generate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.generate(otus, project_members, reference_csv = nil)
                  ::CSV.generate(col_sep: "\t") do |csv|
              
                    csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}
              
              
              Severity: Minor
              Found in lib/export/coldp/files/synonym.rb - About 1 hr to fix

                Method subject_object_scope has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def subject_object_scope(subject_query, object_query, target = 'Otu')
                        a = subject_query
                        b = object_query
                
                        a_sql, b_sql = nil, nil
                Severity: Minor
                Found in lib/queries/biological_association/filter.rb - About 1 hr to fix

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

                  document.addEventListener('turbolinks:load', (_) => {
                    if (document.querySelector('[data-radial-annotator="true"]')) {
                      document
                        .querySelectorAll('[data-radial-annotator="true"]')
                        .forEach((element) => {
                  Severity: Major
                  Found in app/javascript/vue/initializers/RadialAnnotator/main.js and 3 other locations - About 1 hr to fix
                  app/javascript/vue/initializers/MapShape/main.js on lines 33..39
                  app/javascript/vue/initializers/SimpleMap/main.js on lines 18..24
                  app/javascript/vue/initializers/WeekInReviewGraph/main.js on lines 11..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 65.

                  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

                  document.addEventListener('turbolinks:load', (_) => {
                    if (document.querySelector('[data-weeks-review="true"]')) {
                      document
                        .querySelectorAll('[data-weeks-review="true"]')
                        .forEach((element) => {
                  Severity: Major
                  Found in app/javascript/vue/initializers/WeekInReviewGraph/main.js and 3 other locations - About 1 hr to fix
                  app/javascript/vue/initializers/MapShape/main.js on lines 33..39
                  app/javascript/vue/initializers/RadialAnnotator/main.js on lines 20..28
                  app/javascript/vue/initializers/SimpleMap/main.js on lines 18..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 65.

                  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

                  document.addEventListener('turbolinks:load', (event) => {
                    if (document.querySelector('#_simple_map_form')) {
                      document.querySelectorAll('#_simple_map_form').forEach((element) => {
                        init(element)
                      })
                  Severity: Major
                  Found in app/javascript/vue/initializers/SimpleMap/main.js and 3 other locations - About 1 hr to fix
                  app/javascript/vue/initializers/MapShape/main.js on lines 33..39
                  app/javascript/vue/initializers/RadialAnnotator/main.js on lines 20..28
                  app/javascript/vue/initializers/WeekInReviewGraph/main.js on lines 11..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 65.

                  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

                  document.addEventListener('turbolinks:load', (event) => {
                    if (document.querySelector('[data-map-shape]')) {
                      document.querySelectorAll('[data-map-shape]').forEach((element) => {
                        init(element)
                      })
                  Severity: Major
                  Found in app/javascript/vue/initializers/MapShape/main.js and 3 other locations - About 1 hr to fix
                  app/javascript/vue/initializers/RadialAnnotator/main.js on lines 20..28
                  app/javascript/vue/initializers/SimpleMap/main.js on lines 18..24
                  app/javascript/vue/initializers/WeekInReviewGraph/main.js on lines 11..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 65.

                  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

                      tag_list.append($('<li class="tag_item" data-tag-index="' + random_index + '">').append(label).append('&nbsp;').append(TW.views.tags.tag_picker.remove_link()));
                  Severity: Major
                  Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/views/confidences/form.js on lines 77..77

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

                  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

                      confidence_list.append($('<li class="confidence_item" data-confidence-index="' + random_index + '">').append(label).append('&nbsp;').append(TW.views.confidences.form.remove_link()));
                  Severity: Major
                  Found in app/assets/javascripts/views/confidences/form.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/views/tags/tag_picker.js on lines 133..133

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

                  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

                    def sv_not_specific_classes
                      t = taxon_name.name
                      if !t.end_with?('us') &&
                          !t.end_with?('a') &&
                          !t.end_with?('um') &&
                  app/models/taxon_name_classification/latinized/part_of_speech/participle.rb on lines 21..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 62.

                  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 object_taxon_name && object_taxon_name.rank_class
                          if object_taxon_name.type == 'Protonym' || object_taxon_name.type == 'Hybrid'
                            unless self.type_class.valid_object_ranks.include?(self.object_taxon_name.rank_string)
                              errors.add(:object_taxon_name_id, "#{self.object_taxon_name.rank_class.rank_name.capitalize} rank of #{self.object_taxon_name.cached_html} is not compatible with the #{self.subject_status} relationship")
                              errors.add(:type, "Relationship #{self.subject_status} is not compatible with the #{self.object_taxon_name.rank_class.rank_name} rank of #{self.object_taxon_name.cached_html}")
                  Severity: Major
                  Found in app/models/taxon_name_relationship.rb and 1 other location - About 1 hr to fix
                  app/models/taxon_name_relationship.rb on lines 400..407

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

                  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 subject_taxon_name && subject_taxon_name.rank_class
                          if subject_taxon_name.type == 'Protonym' || subject_taxon_name.type == 'Hybrid'
                            unless self.type_class.valid_subject_ranks.include?(self.subject_taxon_name.rank_string)
                              soft_validations.add(:subject_taxon_name_id, "#{self.subject_taxon_name.rank_class.rank_name.capitalize} rank of #{self.subject_taxon_name.cached_html} is not compatible with the #{self.subject_status} relationship")
                              soft_validations.add(:type, "Relationship #{self.subject_status} is not compatible with the #{self.subject_taxon_name.rank_class.rank_name} rank of #{self.subject_taxon_name.cached_html}")
                  Severity: Major
                  Found in app/models/taxon_name_relationship.rb and 1 other location - About 1 hr to fix
                  app/models/taxon_name_relationship.rb on lines 391..398

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

                  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

                    def sv_not_specific_classes
                      t = taxon_name.name
                      if !t.end_with?('us') &&
                          !t.end_with?('a') &&
                          !t.end_with?('um') &&
                  app/models/taxon_name_classification/latinized/part_of_speech/adjective.rb on lines 21..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 62.

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

                  function getAllCollectingEvents(taxonNames) {
                    return new Promise((resolve, reject) => {
                      const chunks = chunkArray(
                        Array.from(
                          new Set(

                    Function saveContainerItems has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        saveContainerItems() {
                          if (!this.container.id) return
                          this.isSaving = true
                    
                          const list = this.containerItems.filter((item) => item.isUnsaved)
                      Severity
                      Category
                      Status
                      Source
                      Language