Showing 2,455 of 5,951 total issues
Method save_import
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def save_import(user, visualization, renamed_tables: {}, full_restore: false)
old_username = visualization.user.username if visualization.user
apply_user_limits(user, visualization)
ActiveRecord::Base.transaction do
visualization.id = random_uuid unless visualization.id && full_restore
- 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
MapTab
has 71 functions (exceeds 20 allowed). Consider refactoring. Open
cdb.admin.MapTab = cdb.core.View.extend({
events: {
'click .toggle_slides.button': '_toggleSlides',
'click .add_overlay.button': 'killEvent',
Method before_save
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
def before_save
super
self.quota_in_bytes = self.quota_in_bytes.to_i if !self.quota_in_bytes.nil? && self.quota_in_bytes != self.quota_in_bytes.to_i
self.updated_at = Time.now
# Set account_type and default values for organization users
- 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
File layer_panel_view.js
has 597 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Layer panel view added in the right menu
*
* - It needs at least layer, visualization and user models.
Function GrouperLayerMapView
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
function GrouperLayerMapView(mapViewClass) {
return {
initialize: function() {
- 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
File style-converter.js
has 582 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('underscore');
var camshaftReference = require('builder/data/camshaft-reference');
var Utils = require('builder/helpers/utils');
var InputQualitativeRamps = require('builder/components/input-color/input-qualitative-ramps/main-view.js');
File content-view.js
has 571 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('underscore');
var CoreView = require('backbone/core-view');
var formatter = require('../../formatter');
var HistogramTitleView = require('./histogram-title-view');
var HistogramChartView = require('./chart');
Method notify_permissions_change
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def notify_permissions_change(permissions_changes)
permissions_changes.each do |c, v|
# At the moment we just check users permissions
if c == TYPE_USER
v.each do |affected_id, perm|
- 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
Function createLayerForAnalysisNode
has 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
createLayerForAnalysisNode: function (nodeId, fromLayerLetter, cfg) {
var userMaxLayers = userModel.get('limits').max_layers;
if (layerDefinitionsCollection.getNumberOfDataLayers() >= userMaxLayers) {
var err = new Error('max layers reached');
err.userMaxLayers = userMaxLayers;
File layer-content-view.js
has 553 lines of code (exceeds 250 allowed). Consider refactoring. Open
var _ = require('underscore');
var $ = require('jquery');
var Backbone = require('backbone');
var CoreView = require('backbone/core-view');
var createTextLabelsTabPaneRouted = require('builder/components/tab-pane/create-text-labels-tab-pane-routed');
File tableview.js
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function() {
/**
* table view shown in admin
File mobile.js
has 547 lines of code (exceeds 250 allowed). Consider refactoring. Open
cdb.admin.overlays.MobileLayers = cdb.core.View.extend({
className: "layer-container",
template: cdb.core.Template.compile('<div class="scrollpane"><ul class="layers"></ul></div>'),
File export_user.rb
has 540 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pg'
require 'redis'
require 'yaml'
require 'optparse'
require 'json'
File visualizations_controller.rb
has 537 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../../models/map/presenter'
require_relative '../carto/admin/user_table_public_map_adapter'
require_relative '../carto/admin/visualization_public_map_adapter'
require_relative '../carto/api/visualization_presenter'
require_relative '../carto/api/received_notification_presenter'
File api_key.rb
has 535 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'securerandom'
require './lib/api_key_grants_validator'
require_dependency 'carto/errors'
require_dependency 'carto/helpers/auth_token_generator'
require_dependency 'carto/oauth_provider/scopes/scopes'
Function exports
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (CodeMirror) {
function Bar (cls, orientation, scroll) {
this.orientation = orientation;
this.scroll = scroll;
this.screen = this.total = this.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
Class DataImport
has 59 methods (exceeds 20 allowed). Consider refactoring. Open
class DataImport < Sequel::Model
include Carto::DataImportConstants
include Carto::Configuration
include Carto::UUIDHelper
include Carto::DataImportCommons
UserModel
has 58 functions (exceeds 20 allowed). Consider refactoring. Open
const UserModel = Backbone.Model.extend({
urlRoot: '/api/v1/users',
defaults: {
avatar_url: 'http://cartodb.s3.amazonaws.com/static/public_dashboard_default_avatar.png',
File map_overlays.js
has 513 lines of code (exceeds 250 allowed). Consider refactoring. Open
//
// manages overlays on the map
//
cdb.admin.MapOverlays = cdb.core.View.extend({
Function _setSchema
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setSchema: function () {
var hasPlaceholder = this.get('type') === GEOREFERENCE_PLACEHOLDER;
BaseAnalysisFormModel.prototype._setSchema.call(this, this._filterSchemaFieldsByType({
type: {
type: 'SelectPlaceholder',