unepwcmc/SAPI

View on GitHub

Showing 253 of 368 total issues

Method resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def resolve(node)
    @expected_full_name = node.expected_full_name(node.parent)
    return node if name_compatible_with_parent?(node)
    Rails.logger.debug("Resolving node name: #{node.full_name} (expected: #{@expected_full_name})")

Severity: Minor
Found in app/services/nomenclature_change/taxonomic_tree_name_resolver.rb - About 35 mins 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    Rails.logger.debug "#{@input_or_output.taxon_concept.full_name} status downgrade from #{@old_status}"
    @linked_names = @linked_inputs_or_outputs.map do |an|
      an.new_taxon_concept || an.taxon_concept
    end.compact
Severity: Minor
Found in app/services/nomenclature_change/status_downgrade_processor.rb - About 35 mins 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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(download_id, params)
    @locale = params['locale']
    @download = Download.find(download_id)
    @download_path = download_location('zip', params)
    @display_name = params['taxon_name'] || MTaxonConcept.find(params['taxon_concept_id']).full_name
Severity: Minor
Found in app/workers/manual_download_worker.rb - About 35 mins 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 summary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def summary
    unless @linked_inputs_or_outputs.empty?
      [
        summary_line_long,
        @linked_inputs_or_outputs.map do |l|
Severity: Minor
Found in app/services/nomenclature_change/status_change_processor.rb - About 35 mins 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 entity_quantity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def entity_quantity
    reported_by_party = sanitise_boolean(@reported_by_party)
    if (reported_by_party && (@reported_by == 'importer')) || (!reported_by_party && (@reported_by == 'exporter'))
      'importer'
    elsif (reported_by_party && (@reported_by == 'exporter')) || (!reported_by_party && (@reported_by == 'importer'))
Severity: Minor
Found in lib/modules/trade/grouping/trade_plus_static.rb - About 35 mins 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

Avoid too many return statements within this method.
Open

          return ''
Severity: Major
Found in lib/modules/trade/grouping/base.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return "IN (#{value})"
    Severity: Major
    Found in lib/modules/trade/grouping/base.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return "IS NULL" if value == 'NULL'
      Severity: Major
      Found in lib/modules/trade/grouping/base.rb - About 30 mins to fix

        Method validate_tmp_taxon_concept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def validate_tmp_taxon_concept
            @tmp_taxon_concept = tmp_taxon_concept
            unless @tmp_taxon_concept
              errors.add(:new_taxon_concept, "can\'t be blank")
            end
        Severity: Minor
        Found in app/models/nomenclature_change/output.rb - About 25 mins 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize(user)
            # Define abilities for the passed in user here. For example:
            #
            #   user ||= User.new # guest user (not logged in)
            #   if user.admin?
        Severity: Minor
        Found in app/models/ability.rb - About 25 mins 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 initialize_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize_params(options)
            @geo_entity_types_set = GeoEntityType::SETS.key?(
              options[:geo_entity_types_set]
              ) &&
              options[:geo_entity_types_set] ||
        Severity: Minor
        Found in app/services/geo_entity_search.rb - About 25 mins 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 listing_with_change_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def listing_with_change_type(listing_change)
            appendix =
              if listing_change.change_type_name == ChangeType::DELETION
                nil
              else
        Severity: Minor
        Found in app/services/checklist/pdf/history_content.rb - About 25 mins 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            @taxon_concept = TaxonConcept.find(params[:id])
            rebuild_taxonomy = @taxon_concept.rebuild_taxonomy?(params)
            update! do |success, failure|
              success.js {
        Severity: Minor
        Found in app/controllers/admin/taxon_concepts_controller.rb - About 25 mins 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 load_change_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def load_change_types
            @change_types = @designation.change_types.order(:name).
              where("name <> '#{ChangeType::EXCEPTION}'")
            @exception_change_type = @designation.change_types.
              find_by_name(ChangeType::EXCEPTION)
        Severity: Minor
        Found in app/controllers/admin/taxon_listing_changes_controller.rb - About 25 mins 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 countries_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def countries_ids
            if respond_to?(:countries_ids_ary) && countries_ids_ary?
              (countries_ids_ary || []).compact
            elsif respond_to? :lc_countries_ids_ary
              (lc_countries_ids_ary || []).compact
        Severity: Minor
        Found in app/models/concerns/m_listing_change.rb - About 25 mins 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            Rails.logger.debug "#{@input_or_output.taxon_concept.full_name} status upgrade from #{@old_status}"
            @linked_names = @linked_inputs_or_outputs.map do |an|
              an.new_taxon_concept || an.taxon_concept
            end.compact
        Severity: Minor
        Found in app/services/nomenclature_change/status_upgrade_processor.rb - About 25 mins 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 new_full_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def new_full_name
            return nil if new_scientific_name.blank?
            rank = new_rank
            parent = new_parent || nomenclature_change.new_output_parent
            if parent && [Rank::SPECIES, Rank::SUBSPECIES].include?(rank.name)
        Severity: Minor
        Found in app/models/nomenclature_change/output.rb - About 25 mins 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            @event = Event.find(params[:event_id]) if params[:event_id]
            @document_batch = DocumentBatch.new(document_batch_params)
            if @document_batch.save
              if @event
        Severity: Minor
        Found in app/controllers/admin/document_batches_controller.rb - About 25 mins 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 ensure_taxonomic_position has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def ensure_taxonomic_position
            if new_record? && fixed_order_required? && taxonomic_position.blank?
              prev_taxonomic_position =
                if parent
                  last_sibling = TaxonConcept.where(:parent_id => parent_id).
        Severity: Minor
        Found in app/models/taxon_concept.rb - About 25 mins 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 lump_blurb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def lump_blurb
            content_tag(:div, class: 'well well-small') do
              concat 'Lumping '
              total = @nomenclature_change.inputs.size
              @nomenclature_change.inputs.each_with_index do |input, idx|
        Severity: Minor
        Found in app/helpers/admin/nomenclature_changes_helper.rb - About 25 mins 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

        Severity
        Category
        Status
        Source
        Language