SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

Method autocomplete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def autocomplete

        # [ query, order by use if true- don't if nil ]
        queries = [
          [ autocomplete_exact_id, false],
Severity: Minor
Found in lib/queries/source/autocomplete.rb - About 1 hr 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 5 locations. Consider refactoring.
Open

  def create
    @document = Document.new(document_params)

    respond_to do |format|
      if @document.save
Severity: Major
Found in app/controllers/documents_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/collecting_events_controller.rb on lines 39..47
app/controllers/geographic_areas_geographic_items_controller.rb on lines 18..27
app/controllers/repositories_controller.rb on lines 30..39
app/controllers/taxon_determinations_controller.rb on lines 42..51

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

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 update
    respond_to do |format|
      if @serial_chronology.update(serial_chronology_params)
        format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Serial chronology was successfully updated.')}
        format.json {head :no_content}
Severity: Major
Found in app/controllers/serial_chronologies_controller.rb and 1 other location - About 1 hr to fix
app/controllers/biocuration_classifications_controller.rb on lines 31..38

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

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 self.csv(biological_associations)

    data = ApplicationController.helpers.extended_hash(biological_associations)

    tbl = []
Severity: Major
Found in lib/export/csv/biological_associations/extended.rb and 1 other location - About 1 hr to fix
lib/export/csv/biological_associations/simple.rb on lines 17..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 50.

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

  def create
    @taxon_determination = TaxonDetermination.new(taxon_determination_params)

    respond_to do |format|
      if @taxon_determination.save
Severity: Major
Found in app/controllers/taxon_determinations_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/collecting_events_controller.rb on lines 39..47
app/controllers/documents_controller.rb on lines 42..51
app/controllers/geographic_areas_geographic_items_controller.rb on lines 18..27
app/controllers/repositories_controller.rb on lines 30..39

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

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 create_primers_batch_load
    if params[:file] && digested_cookie_exists?(params[:file].tempfile, :Primers_sequences_md5)
      @result = BatchLoad::Import::SequenceRelationships::PrimersInterpreter.new(**batch_params)
      if @result.create!
        flash[:notice] = "Successfully proccessed file, #{@result.total_records_created} " \
Severity: Major
Found in app/controllers/sequence_relationships_controller.rb and 1 other location - About 1 hr to fix
app/controllers/descriptors_controller.rb on lines 143..160

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

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 update
    respond_to do |format|
      if @biocuration_classification.update(biocuration_classification_params)
        format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Biocuration classification was NOT successfully updated.')}
        format.json { head :no_content }
Severity: Major
Found in app/controllers/biocuration_classifications_controller.rb and 1 other location - About 1 hr to fix
app/controllers/serial_chronologies_controller.rb on lines 24..31

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

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

  def create
    @collecting_event = CollectingEvent.new(collecting_event_params)
    respond_to do |format|
      if @collecting_event.save
        format.html { redirect_to @collecting_event, notice: 'Collecting event was successfully created.' }
Severity: Major
Found in app/controllers/collecting_events_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/documents_controller.rb on lines 42..51
app/controllers/geographic_areas_geographic_items_controller.rb on lines 18..27
app/controllers/repositories_controller.rb on lines 30..39
app/controllers/taxon_determinations_controller.rb on lines 42..51

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

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

    singleDrawnFeatureToMapListeners: function (this_map, map_item, feature_control) {
      google.maps.event.addListener(this_map[1], 'overlaycomplete', function (event) {
          // Remove the last created shape if it exists.
          if (map_item != null) {
            if (map_item[0] != null) {
Severity: Minor
Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 1 hr to fix

    Function openSlideoutPanel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      openSlideoutPanel: function (panel) {
        if ($(panel).hasClass('slide-left')) {
          $(panel).css('right', '')
          if ($(panel).css('left') != '0px') {
            if ($(panel).attr('data-panel-position') == 'relative') {
    Severity: Minor
    Found in app/assets/javascripts/views/shared/slideout.js - About 1 hr to fix

      Function initialize_citation_topic_autocomplete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function initialize_citation_topic_autocomplete(form) {
        var autocomplete_input = form.find(".citation_topic_autocomplete");
      
        autocomplete_input.autocomplete({
          source: '/topics/lookup_topic',
      Severity: Minor
      Found in app/assets/javascripts/views/citations/_topic_picker.js - About 1 hr to fix

        Function cleanPinboardItems has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          cleanPinboardItems({ type, section }) {
            const CSRFToken = document
              .querySelector('meta[name="csrf-token"]')
              .getAttribute('content')
            const headers = { 'X-CSRF-Token': CSRFToken }
        Severity: Minor
        Found in app/assets/javascripts/workbench/pinboard.js - About 1 hr to fix

          Function default has 27 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 mx_field_observer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              $.fn.mx_field_observer = function() {
            
                if (!this.length) {   return this; }
            
                return this.each(function() {

              Method set_taxonomy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def set_taxonomy
                    c = case self.class.base_class.name
                        when 'CollectionObject'
                          a = target_taxon_name # current_valid_taxon_name # !! See DwcExtensions, probably better placed here
              
              
              Severity: Minor
              Found in app/models/concerns/shared/taxonomy.rb - About 1 hr to fix

                Method code_column has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.code_column(observation_matrix_column_id, observation_params)
                    c = ObservationMatrixColumn.find(observation_matrix_column_id)
                    o = ObservationMatrix.find(c.observation_matrix_id)
                
                    descriptor = c.descriptor
                Severity: Minor
                Found in app/models/observation.rb - About 1 hr to fix

                  Method observation_export_value has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def observation_export_value(observation)
                      case observation.type
                      when 'Observation::Qualitative'
                        LABEL_REPLACEMENT[observation.character_state.label].nil? ? observation.character_state.label : LABEL_REPLACEMENT[observation.character_state.label]
                      when 'Observation::PresenceAbsence'
                  Severity: Minor
                  Found in app/helpers/observation_matrices_helper.rb - About 1 hr to fix

                    Method sv_species_gender_agreement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def sv_species_gender_agreement
                          if is_species_rank?
                            s = part_of_speech_name
                            if !s.nil? && is_available?
                              if %w{adjective participle}.include?(s)
                    Severity: Minor
                    Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

                      Method sessions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.sessions(records)
                          return [] if records.none?
                      
                          r = records.to_a
                      
                      
                      Severity: Minor
                      Found in lib/work.rb - About 1 hr to fix

                        Method process_result has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def process_result(use_thumbnail: true)
                              begin
                                sqed.use_thumbnail = use_thumbnail
                                r = sqed.result
                              rescue Sqed::Error
                        Severity: Minor
                        Found in lib/vendor/sqed_to_taxonworks.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language