SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

Method descriptors_hash_initiate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def descriptors_hash_initiate
    h = {}

    descriptors_with_keywords.each do |d|
      h[d.id] = {}
Severity: Minor
Found in lib/tools/interactive_key.rb - About 1 hr to fix

    Method descriptors_hash_initiate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def descriptors_hash_initiate
        h = {}
    
        # Depictions is depictions with other attributes added
        depictions = nil
    Severity: Minor
    Found in lib/tools/image_matrix.rb - About 1 hr to fix

      Method bibtex_from_citproc has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.bibtex_from_citproc(c, b)
            return nil unless c.present? && b.present?
            c = JSON.parse(c)
      
            b[:address] = ::Utilities::Strings.encode_with_utf8(c['address']) unless c['address'].blank?
      Severity: Minor
      Found in lib/vendor/serrano.rb - About 1 hr to fix

        Method nearby_from_params has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.nearby_from_params(params)
              nearby_distance = params['nearby_distance'].to_i
              nearby_distance = CollectingEvent::NEARBY_DISTANCE if nearby_distance == 0
        
              decade = case nearby_distance.to_s.length
        Severity: Minor
        Found in lib/utilities/geo.rb - About 1 hr to fix

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

          export default function (observationData) {
            const observation = makeBaseObservation(observationData)
            return Object.assign(observation, {
              characterStateId: observationData.characterStateId || observationData.character_state_id,
              isChecked: !!observationData.id
          app/javascript/vue/tasks/observation_matrices/matrix_column_coder/helpers/makeQualitativeObservation.js on lines 3..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 63.

          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 function (observationData) {
            const observation = makeBaseObservation(observationData)
            return Object.assign(observation, {
              characterStateId: observationData.characterStateId || observationData.character_state_id,
              isChecked: !!observationData.id
          app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/helpers/makeQualitativeObservation.js on lines 3..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 63.

          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_label_mirroring: function (form) {
              form.find(".keyword_picker_form input").on("change keyup", function () {
                form.find(".name_label").html(
                  form.find(".name").val()
                );
          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/citations/_topic_picker.js on lines 105..111

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

          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

          function bind_topic_label_mirroring(form) {
            form.find(".citation_topic_picker_topic_form input").on("change keyup", function () {
              form.find(".name_label").text(
                form.find(".name").val()
              );
          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/tags/tag_picker.js on lines 185..191

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

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

            def create
              @otu_page_layout_section = OtuPageLayoutSection.new(otu_page_layout_section_params)
          
              respond_to do |format|
                if @otu_page_layout_section.save
          Severity: Major
          Found in app/controllers/otu_page_layout_sections_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/citation_topics_controller.rb on lines 8..17
          app/controllers/container_items_controller.rb on lines 24..32
          app/controllers/public_contents_controller.rb on lines 8..17
          app/controllers/serial_chronologies_controller.rb on lines 8..17
          app/controllers/tagged_section_keywords_controller.rb on lines 8..17

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

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

            def create
              @serial_chronology = SerialChronology.new(serial_chronology_params)
          
              respond_to do |format|
                if @serial_chronology.save
          Severity: Major
          Found in app/controllers/serial_chronologies_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/citation_topics_controller.rb on lines 8..17
          app/controllers/container_items_controller.rb on lines 24..32
          app/controllers/otu_page_layout_sections_controller.rb on lines 8..17
          app/controllers/public_contents_controller.rb on lines 8..17
          app/controllers/tagged_section_keywords_controller.rb on lines 8..17

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

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

            def create
              @citation_topic = CitationTopic.new(citation_topic_params)
          
              respond_to do |format|
                if @citation_topic.save
          Severity: Major
          Found in app/controllers/citation_topics_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/container_items_controller.rb on lines 24..32
          app/controllers/otu_page_layout_sections_controller.rb on lines 8..17
          app/controllers/public_contents_controller.rb on lines 8..17
          app/controllers/serial_chronologies_controller.rb on lines 8..17
          app/controllers/tagged_section_keywords_controller.rb on lines 8..17

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

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

            def create
              @public_content = PublicContent.new(public_content_params)
          
              respond_to do |format|
                if @public_content.save
          Severity: Major
          Found in app/controllers/public_contents_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/citation_topics_controller.rb on lines 8..17
          app/controllers/container_items_controller.rb on lines 24..32
          app/controllers/otu_page_layout_sections_controller.rb on lines 8..17
          app/controllers/serial_chronologies_controller.rb on lines 8..17
          app/controllers/tagged_section_keywords_controller.rb on lines 8..17

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

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

            def create
              @tagged_section_keyword = TaggedSectionKeyword.new(tagged_section_keyword_params)
          
              respond_to do |format|
                if @tagged_section_keyword.save
          Severity: Major
          Found in app/controllers/tagged_section_keywords_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/citation_topics_controller.rb on lines 8..17
          app/controllers/container_items_controller.rb on lines 24..32
          app/controllers/otu_page_layout_sections_controller.rb on lines 8..17
          app/controllers/public_contents_controller.rb on lines 8..17
          app/controllers/serial_chronologies_controller.rb on lines 8..17

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

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

            def create
              @container_item = ContainerItem.new(container_item_params)
              respond_to do |format|
                if @container_item.save
                  format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was successfully created.')}
          Severity: Major
          Found in app/controllers/container_items_controller.rb and 5 other locations - About 1 hr to fix
          app/controllers/citation_topics_controller.rb on lines 8..17
          app/controllers/otu_page_layout_sections_controller.rb on lines 8..17
          app/controllers/public_contents_controller.rb on lines 8..17
          app/controllers/serial_chronologies_controller.rb on lines 8..17
          app/controllers/tagged_section_keywords_controller.rb on lines 8..17

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

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

            function saveGraph() {
              const biologicalAssociationsSaved = state.biologicalAssociations.filter(
                (r) => r.id
              )
              const biologicalAssociationsInGraph =

            Function initialize_autocomplete has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initialize_autocomplete: function (form) {
                var autocomplete_input = form.find(".role_picker_autocomplete");
            
                autocomplete_input.autocomplete({
                  source: '/people/autocomplete',
            Severity: Minor
            Found in app/assets/javascripts/views/people/_role_picker.js - About 1 hr to fix

              Function init has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                init: function () {
                  const listElements = [...document.querySelectorAll('.recent_updates li')]
              
                  listElements.forEach((el) =>
                    el.addEventListener('dblclick', function (e) {
              Severity: Minor
              Found in app/assets/javascripts/views/shared/recent_updates.js - About 1 hr to fix

                Function attachMouseEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  attachMouseEvent (bubbleElement) {
                    bubbleElement.addEventListener('mouseenter', event => {
                      const elementLegend = document.querySelector('.help-legend')
                      const element = event.target
                      const position = this.getOffset(element)
                Severity: Minor
                Found in app/assets/javascripts/workbench/help.js - About 1 hr to fix

                  Method is_stale_metadata has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  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 - About 1 hr to fix

                    Method build_descriptors has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def build_descriptors
                          @total_data_lines = 0
                          i = 0
                    
                          # loop through rows
                      Severity
                      Category
                      Status
                      Source
                      Language