SpeciesFileGroup/taxonworks

View on GitHub

Showing 740 of 12,584 total issues

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

  def self.generate(otus, project_members, reference_csv = nil )
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{
        nameID
Severity: Minor
Found in lib/export/coldp/files/name_relation.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

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

  def self.define(*args, &block)
    task_number = @@task_number += 1

    task_sym = "__LOGGED_ROOT_TASK_DETECTOR_#{task_number}".to_sym

Severity: Minor
Found in lib/logged_task.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

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

Method subject_object_scope has a Cognitive Complexity of 10 (exceeds 5 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

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

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

  def self.topic_year_metadata(entry_item_list)
    h = {}
    entry_item_list.each do |i|
      y = i.nomenclature_date&.year
      y ||= 'unknown'
Severity: Minor
Found in lib/catalog.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

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

  def to_s
    d = data
    str = ''

    d.keys.sort{|a,b| (a || 'zzz') <=> (b || 'zzz')}.each do |c|
Severity: Minor
Found in lib/catalog/distribution/entry.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

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

        function loadAttributes(params) {
          const request = ajaxCall(
            'get',
            '/tasks/data_attributes/field_synchronize/values',
            {

        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 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 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() {

              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

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

                            def initialize(query_params)
                              super
                      
                              @collectors = boolean_param(params, :collectors )
                              @collecting_event_id = params[:collecting_event_id]
                      Severity: Minor
                      Found in lib/queries/collecting_event/filter.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

                          Function bind_radio_buttons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            bind_radio_buttons: function () {     // for regex match table
                              $('.select_dates').click(function () {
                                // selector not working
                                var start_date = $(this).parent().parent('.extract_row').children('.start_date_value').text();
                                var end_date = $(this).parent().parent('.extract_row').children('.end_date_value').text();

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

                              init: function () {
                                var nodeChecked;
                                var that = this;
                            
                                document.querySelectorAll('input[name=source\\[type\\]]').forEach(node => {
                            Severity: Minor
                            Found in app/assets/javascripts/views/sources/_form.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language