Showing 253 of 368 total issues
Method initialize_query
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize_query
@query = MAutoCompleteTaxonConcept.all
@query =
if @visibility == :trade
Method nomenclature_change_status_to_accepted_params
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def nomenclature_change_status_to_accepted_params
params.require(:nomenclature_change_status_to_accepted).permit(
:created_by_id, :updated_by_id, :event_id, :status,
primary_output_attributes: [
:id, :_destroy,
Method nomenclature_change_status_swap_params
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def nomenclature_change_status_swap_params
params.require(:nomenclature_change_status_swap).permit(
:event_id, :status,
primary_output_attributes: [
:id, :_destroy,
Method higher_taxa_headers
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def higher_taxa_headers(prev_item, curr_item)
ranks =
if prev_item.nil?
@header_ranks
else
- 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 taxonomic_grouping_per_year
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def taxonomic_grouping_per_year(year)
conversion = read_taxonomy_conversion
res = {}
# Get all the non-compliant shipments in a given year
- 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
Class Base
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Trade::Grouping::Base
attr_reader :query
TAXONOMIC_GROUPING = 'lib/data/group_conversions.csv'.freeze
Class Compliance
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Trade::Grouping::Compliance < Trade::Grouping::Base
# Complete up to current year - 1
COUNTRIES = {
2022 => 183,
Method copied_object_before_save
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copied_object_before_save(reassignment, reassignable)
return nil if conflicting_listing_change_reassignment?(reassignment, reassignable)
new_taxon_concept = @output.new_taxon_concept || @output.taxon_concept
Rails.logger.debug("Processing #{reassignable.class} #{reassignable.id} copy to #{new_taxon_concept.full_name}")
Method run_queries
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_queries
sql = <<-SQL
WITH rows_to_insert AS (
#{rows_to_insert_sql}
), rows_to_insert_resolved AS (
Method add_intervals
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_intervals
(@timelines + [self]).flatten.each do |timeline|
timeline.timeline_events.each_with_index do |event, idx|
interval =
if idx < (timeline.timeline_events.size - 1)
- 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 validate_each
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
require 'csv'
begin
- 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 full_db_query_by_kingdom
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.full_db_query_by_kingdom(year, kingdom)
"SELECT
shipments.id AS id,
year AS year,
appendix AS appendix,
Method full_db_query
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.full_db_query(limit, offset)
"SELECT
shipments.id AS id,
year AS year,
appendix AS appendix,
Class Constructor
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class NomenclatureChange::Split::Constructor
include NomenclatureChange::ConstructorHelpers
def initialize(nomenclature_change)
@nomenclature_change = nomenclature_change
Method full_db_query_by_year
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.full_db_query_by_year(year)
"SELECT
shipments.id AS id,
year AS year,
appendix AS appendix,
Method full_db_query_single_file
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.full_db_query_single_file(limit, offset)
"SELECT
shipments.id AS id,
year AS year,
appendix AS appendix,
Method initialize_query
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def initialize_query
@query = MAutoCompleteTaxonConcept.all
@query =
if @visibility == :trade
- 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 run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run
total = Document.count
identification_docs.each_with_index do |doc, idx|
info_txt = "#{doc.elib_legacy_file_name} (#{idx + 1} of #{total})"
target_location = @target_dir + "/documents/#{doc.id}/#{doc.elib_legacy_file_name}"
- 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 get_condition_value
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_condition_value(key, value)
column_name = self.class.filtering_attributes[key.to_sym]
# It's not a number (positive number to be precise)
if !/\A\d+\z/.match(value)
- 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 summarise_filters
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.summarise_filters(params)
summary = []
options = Checklist::ChecklistParams.sanitize(params)
options.keys.each { |k| instance_variable_set("@#{k}", options[k]) }