Showing 5,951 of 5,951 total issues
Method rollback_import_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rollback_import_data(package)
org_import? ? self.organization = nil : self.user = nil
save!
return unless import_data?
- 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_children
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_children(definition, path = [])
children = definition.map do |k, v|
if v.is_a?(Hash)
this_path = path + [k]
if (MANDATORY_KEYS_FOR_ANALYSIS_NODE - v.keys).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 get_downloader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_downloader(datasource_provider)
log.append("Fetching datasource #{datasource_provider} metadata for item id #{service_item_id}")
metadata = datasource_provider.get_resource_metadata(service_item_id)
- 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 remaining_days_deletion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remaining_days_deletion
return nil unless state == STATE_LOCKED
deletion_date = Cartodb::Central.new.get_user(username).fetch('scheduled_deletion_date', nil)
return nil unless deletion_date
- 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 visualization_count
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visualization_count(filters = {})
return 0 unless id
vqb = Carto::VisualizationQueryBuilder.new
vqb.with_type(filters[:type]) if filters[:type]
- 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 compatible_schemas_for_overwrite?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compatible_schemas_for_overwrite?(name)
orig_schema = user.in_database.schema(results.first.tables.first, reload: true, schema: ORIGIN_SCHEMA)
dest_schema = user.in_database.schema(name, reload: true, schema: user.database_schema)
# NOTE: Sanitize columnn names from 'orig_schema' due to the 'dest_schema' columns were
- 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 unauthenticated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unauthenticated
username = extract_username(request, params)
CartoDB::Stats::Authentication.instance.increment_failed_login_counter(username)
# Use an instance variable to show the error instead of the flash hash. Setting the flash here means setting
- 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_privacy_changes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_privacy_changes
if !user.try(:private_tables_enabled) && !public? && (new_record? || privacy_changed?)
errors.add(:privacy, 'unauthorized to create private tables')
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 validate_ips
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_ips
# Check type
unless ips.kind_of?(Array) && ips.all? { |ip| ip.kind_of?(String) }
errors.add(:ips, "IPs must be an array of strings ")
return false
- 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 promote_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def promote_user
return unless @promote_to_organization_owner
organization = Carto::Organization.find_by(id: organization_id)
raise "Trying to set organization owner when there's already one" unless organization.owner.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
Method send_to_organization_members
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_to_organization_members
return unless organization
# This avoids resending an already sent notification. Example: importing notifications
return unless received_notifications.empty?
users = if recipients == 'builders'
- 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 unique_overlay_not_duplicated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unique_overlay_not_duplicated
# This check probably belongs in visualization. See #6919
if UNIQUE_TYPES.include?(type)
other_overlay = Carto::Overlay.where(visualization_id: visualization_id, type: type)
other_overlay = other_overlay.where('id != ?', id) unless new_record?
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(org_id, owner_id)
@owner = ::User.where(:id => owner_id).first
raise "The organization needs a owner" if @owner.nil?
if !@owner.organization_id.nil? && @owner.organization_id != org_id
raise "The user already has a organization and it's not #{org_id}"
- 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 children
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def children
ordered = []
children_vis = self.unordered_children
if children_vis.count > 0
ordered << children_vis.select { |vis| vis.prev_id.nil? }.first
- 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 embed_map_actual
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def embed_map_actual
return(embed_forbidden) if @visualization.private?
return(embed_protected) if @visualization.password_protected?
return(show_organization_embed_map) if org_user_has_map_permissions?(current_user, @visualization)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def update
# check if it's valid token
if @user.password_reset_sent_at < 48.hours.ago
redirect_to(new_password_reset_path, alert: "Password reset has expired")
return
- 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 migrate_builder_infowindow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def migrate_builder_infowindow(templated_element, mustache_dir: 'infowindows')
return nil if templated_element.nil?
template = templated_element['template']
return templated_element if template.present?
- 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 embed_map
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def embed_map
if request.format == 'text/javascript'
error_message = "/* Javascript embeds are deprecated, please use the html iframe instead */"
return render inline: error_message, status: 400
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 load_visualization_from_id_or_name_guessing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_visualization_from_id_or_name_guessing(id_or_name, force_name:)
viz_locator = VisualizationLocator.new(id_or_name, force_name: force_name)
visualization = if viz_locator.id
get_priority_visualization_forcing_name(viz_locator.id, force_name: force_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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
return head(401) unless current_user.sync_tables_enabled || @external_source
@stats_aggregator.timing('synchronizations.create') do
- 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"