Showing 253 of 368 total issues
Method import
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import(data)
# Array of CitesRstProcesses in current import we can use to
# destroy records no longer being returned from the RST API.
active_ids = []
data.map do |item|
Method search_params
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_params
(params[:filters] || params).permit(
:reporter_type,
:time_range_start,
:time_range_end,
Method initialize
has 26 lines of code (exceeds 25 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?
Method sql_columns
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sql_columns
general_subtype_column = <<-SQL
case
when general_subtype is TRUE
then 'Whole animals/plants'
Method data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data
Ahoy::Event.from(<<-SQL
(
WITH weeks_as_timestamps AS (
SELECT * FROM generate_series(
Method event_types_with_names
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.event_types_with_names
[
{
id: 'CitesCop',
name: 'CITES CoP'
Method download
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download
respond_to do |format|
format.html {
search = Trade::ShipmentsExportFactory.new(search_params.merge({
:per_page => Trade::ShipmentsExport::PUBLIC_CSV_LIMIT
Method matching_records_arel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def matching_records_arel(table_name)
s = Arel::Table.new("#{table_name}_view")
tc = Arel::Table.new('taxon_concepts')
t = Arel::Table.new('taxonomies')
Function parseTaxonCascadeData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseTaxonCascadeData(data, term, showSpp) {
var d = data.auto_complete_taxon_concepts;
var data_by_rank = [];
var currentRank = d[0].rank_name;
data_by_rank.push({
Method _build_document_reassignment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _build_document_reassignment(document_citation, input, outputs)
reassignment = input.document_citation_reassignment_class.new(
reassignable_type: 'DocumentCitation',
reassignable_id: document_citation.id
)
Method generate_timelines
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_timelines
@raw_timelines = {}
['I', 'II', 'III'].each do |species_listing_name|
@raw_timelines[species_listing_name] = Checklist::Timeline.new(
:taxon_concept_id => @taxon_concept_id,
Method resolve
has 26 lines of code (exceeds 25 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})")
Consider simplifying this complex logical expression. Open
if annotation &&
annotation.short_note_en.blank? &&
annotation.short_note_fr.blank? &&
annotation.short_note_es.blank? &&
annotation.full_note_en.blank? &&
Consider simplifying this complex logical expression. Open
return nil unless shipment.source && (
shipment.taxon_concept &&
shipment.taxon_concept.data['kingdom_name'] == 'Animalia' &&
INVALID_KINGDOM_SOURCE['ANIMALIA'].include?(shipment.source.code) ||
shipment.taxon_concept &&
Method changeable_after_save_callback_on_commit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def changeable_after_save_callback_on_commit
changeable_clear_cache
# For models that are not directly related to taxon concepts
# but for which is anyway preferable for the changes to be reflacted
- 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 admin_new_modal
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def admin_new_modal(options = {})
resource = options[:resource] || controller_name.singularize
id = options[:id] || "new-#{resource}"
title = options[:title] || "Add new #{resource.titleize}"
content_tag(
- 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_rank_options_to_rel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def apply_rank_options_to_rel
@rank_id = @rank_options && @rank_options[:id]
if @rank_id
@rank_scope = @rank_options[:scope] || ''
rank = Rank.find(@rank_id) if @rank_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 comparison_conditions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def comparison_conditions(comparison_attributes = nil)
comparison_attributes ||= self.comparison_attributes
a = self.class.all
arel_nodes = []
comparison_attributes.each do |attr_name, attr_val|
- 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 changeable_after_save_callback
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def changeable_after_save_callback
unless respond_to?(:taxon_concept)
return
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 show
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def show
builder = NomenclatureChange::Split::Constructor.new(@nomenclature_change)
case step
when :inputs
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"