Showing 253 of 368 total issues
Method available_columns
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def available_columns
{
:id => { :internal => true },
:year => {},
:appendix => {},
Function displayResults
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayResults (q) {
var table_view_title, formURL = '/' + locale + '/cites_trade/shipments',
data_headers, data_rows, table_tmpl,
comptab_regex = /comptab/,
gross_net_regex = /(gross_exports|gross_imports|net_exports|net_imports)/;
Method kingdom_summary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.kingdom_summary(t, k)
puts "#############################################################"
puts "#############################################################"
puts ">>> #{k.full_name} general stats"
Method import_species_distributions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import_species_distributions
sql = <<-SQL
WITH doc_taxon_tmp AS (
SELECT dc.id doc_cit_id, dctc.taxon_concept_id tc_id
FROM document_citation_taxon_concepts dctc
Method validate_each
has 28 lines of code (exceeds 25 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
Method batch_update_params
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def batch_update_params
update_params = params.permit(
:updates => shipment_attributes
)
res = update_params && update_params.delete('updates') || {}
- 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 to_csv
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.to_csv(file_path, filters)
limit = 1000
offset = 0
csv_separator_char =
case filters[:csv_separator]
- 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 show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show
builder = klass::Constructor.new(@nomenclature_change)
case step
when :primary_output
set_events
- 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 update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
@nomenclature_change.assign_attributes(
(nomenclature_change_status_swap_params || {}).merge({
:status => (step == steps.last ? NomenclatureChange::SUBMITTED : step.to_s)
})
- 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 update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
@nomenclature_change.assign_attributes(
(nomenclature_change_status_to_synonym_params || {}).merge({
:status => (step == steps.last ? NomenclatureChange::SUBMITTED : step.to_s)
})
- 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 populate_taxon_concept_fields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def populate_taxon_concept_fields
self.parent_id = taxon_concept.parent_id_changed? ? taxon_concept.parent_id_was : taxon_concept.parent_id
self.rank_id = taxon_concept.rank_id_changed? ? taxon_concept.rank_id_was : taxon_concept.rank_id
self.scientific_name = taxon_concept.full_name_changed? ? taxon_concept.full_name_was : taxon_concept.full_name
self.author_year = taxon_concept.author_year_changed? ? taxon_concept.author_year_was : taxon_concept.author_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
Method update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
@nomenclature_change.assign_attributes(
(nomenclature_change_lump_params || {}).merge({
:status => (step == steps.last ? NomenclatureChange::SUBMITTED : step.to_s)
})
- 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_zip
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def download_zip
@documents = Document.find(params[:ids].split(','))
t = Tempfile.new('tmp-zip-' + request.remote_ip)
missing_files = []
- 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 zip_file_generator
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def zip_file_generator
missing_files = []
pdf_file_paths = []
tmp_dir_path = [Rails.root, "/tmp/", SecureRandom.hex(8)].join
FileUtils.mkdir tmp_dir_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 generate_mapping_table_rows
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_mapping_table_rows(rule)
formatted_input = input_flattening(rule)
formatted_input.delete_if { |_, v| v.empty? }
output = rule['output']
modifier = output['quantity_modifier'] ? "'#{output['quantity_modifier']}'" : 'NULL'
- 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_zip
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download_zip
@documents = Document.find(params[:ids].split(','))
t = Tempfile.new('tmp-zip-' + request.remote_ip)
missing_files = []
Method perform
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(*args)
# rake "dashboard_stats:cache:update"
DashboardStatsCache.update_dashboard_stats
# rake "db:common_names:cleanup"
Method select_columns
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_columns
[
"taxon_concepts_mview.id AS id",
"taxon_concepts_mview.kingdom_name",
"taxon_concepts_mview.phylum_name",
Method columns_with_type
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def columns_with_type
[
['EventTypeID', 'TEXT'],
['EventTypeName', 'TEXT'],
['splus_event_type', 'TEXT'],
Method update_checklist_downloads
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.update_checklist_downloads
puts "Updating CITES Checklist downloads"
modules = [
Checklist::Pdf,
Checklist::Csv,