Showing 253 of 368 total issues
Method initialize_query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize_query
@taxon_concepts_rel = MTaxonConcept.all.
by_cites_eu_taxonomy
if @cites_regions.empty? && @countries.empty? && !@cites_appendices.empty?
- Read upRead up
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 access_denied_error
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def access_denied_error(exception)
rescue_path = if request.referrer && request.referrer != request.url
request.referer
elsif current_user.is_manager_or_contributor_or_secretariat?
admin_root_path
- Read upRead up
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 download
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def download
set_csv_separator
@filters = filter_params.merge({
:csv_separator => cookies['speciesplus.csv_separator'].try(:to_sym)
- Read upRead up
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 add_conditions_for_document
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_conditions_for_document
@query = @query.search_by_title(@title_query) if @title_query.present?
if @document_type.present?
@query = @query.where('document_type IN (?)', @document_type.split(','))
- Read upRead up
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 save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save
return false unless valid?
success = true
Document.transaction do
@documents.each do |d|
- Read upRead up
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 process_unreassigned_taxon_concept_citations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_unreassigned_taxon_concept_citations
citations = @input.document_citation_reassignments.map { |c|
c.reassignable if _is_input_reassignment(c)
}.compact
- Read upRead up
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_change_before_save_callback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def listing_change_before_save_callback
# check if annotation should be deleted
if annotation &&
annotation.short_note_en.blank? &&
annotation.short_note_fr.blank? &&
- Read upRead up
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 apply_taxon_concept_options_to_rel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def apply_taxon_concept_options_to_rel
@taxon_concept_id = @taxon_concept_options && @taxon_concept_options[:id]
if @taxon_concept_id
@taxon_concept_scope = @taxon_concept_options[:scope] || ''
taxon_concept = TaxonConcept.find(@taxon_concept_id) if @taxon_concept_scope
- Read upRead up
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 sanitized_shipments_scope
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sanitized_shipments_scope
res = {}
sanitized_sandbox_scope.each do |scope_column, scope_def|
case scope_column
when 'taxon_name', 'rank'
- Read upRead up
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 common_names_with_lng_initials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def common_names_with_lng_initials(taxon_concept)
res = ''
unless !@english_common_names || taxon_concept.english_names.empty?
res += " (E) #{LatexToPdf.escape_latex(taxon_concept.english_names.join(', '))} "
end
- Read upRead up
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 taxon_concept_internal_note_label
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def taxon_concept_internal_note_label(comment)
content_tag(:label) do
content_tag(:p, class: 'internal-notes-type') do
comment.comment_type + ' note'
end +
- Read upRead up
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 count_matching
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.count_matching(params)
Quota.where(
[
"EXTRACT(year from start_date)::INTEGER = :year
AND ((:excluded_geo_entities) IS NULL OR geo_entity_id NOT IN (:excluded_geo_entities))
- Read upRead up
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 split_outputs_blurb
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def split_outputs_blurb
return '' if @nomenclature_change.outputs.empty? ||
@nomenclature_change.outputs.map(&:display_full_name).compact.empty?
html = ' into '
total = @nomenclature_change.outputs.size
- Read upRead up
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 prepare_chain
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prepare_chain
chain = []
chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@primary_output)
chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@secondary_output)
- Read upRead up
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 default_separator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def default_separator(ip)
invalid_addresses = ['127.0.0.1', nil, 'localhost', 'nil', '', 'unknown']
if invalid_addresses.include?(ip)
:comma
- Read upRead up
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 sanitise_positive_integer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sanitise_positive_integer(i, default = nil)
new_i =
if i.is_a?(String)
tmp = i.to_i
tmp.to_s == i ? tmp : nil
- Read upRead up
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
Consider simplifying this complex logical expression. Open
if (event.is_addition? || event.is_amendment? || event.is_deletion?) &&
@current || event.is_reservation? && event.is_current
@continues_in_present = true
Checklist::TimelineInterval.new(
:taxon_concept_id => @taxon_concept_id,
Consider simplifying this complex logical expression. Open
if prev_event && (
prev_event.is_addition? ||
prev_event.change_type_name == 'AMENDMENT'
) &&
event.is_addition? &&
Consider simplifying this complex logical expression. Open
if reassignment.is_a?(NomenclatureChange::Reassignment) && (
reassignable.is_a?(ListingChange) ||
reassignable.is_a?(CitesSuspension) || reassignable.is_a?(Quota) ||
reassignable.is_a?(EuSuspension) || reassignable.is_a?(EuOpinion)
)
Consider simplifying this complex logical expression. Open
if reassignment.is_a?(NomenclatureChange::Reassignment) && (
reassignable.is_a?(ListingChange) ||
reassignable.is_a?(CitesSuspension) || reassignable.is_a?(Quota) ||
reassignable.is_a?(EuSuspension) || reassignable.is_a?(EuOpinion)
)