CartoDB/cartodb20

View on GitHub

Showing 2,455 of 5,951 total issues

Function _renderLayerTabPaneView has 203 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _renderLayerTabPaneView: function () {
    var self = this;
    var analysisPayload = this.options.analysisPayload;
    var layerId = this._layerDefinitionModel.get('id');
    var canBeGeoreferenced = this._viewState.get('canBeGeoreferenced');
Severity: Major
Found in lib/assets/javascripts/builder/editor/layers/layer-content-view.js - About 1 day to fix

    Function exports has 200 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(CodeMirror) {
    "use strict";
    
    CodeMirror.defineMode("sql", function(config, parserConfig) {
      "use strict";
    Severity: Major
    Found in lib/assets/javascripts/builder/components/code-mirror/mode/sql.js - About 1 day to fix

      Class VisualizationQueryBuilder has 56 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Carto::VisualizationQueryBuilder
        include Carto::UUIDHelper
      
        def self.user_public_tables(user)
          user_public(user).with_type(Carto::Visualization::TYPE_CANONICAL)
      Severity: Major
      Found in app/queries/carto/visualization_query_builder.rb - About 1 day to fix

        File member.rb has 490 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'virtus'
        require_relative 'adapter'
        require_relative '../../../services/importer/lib/importer'
        require_relative '../visualization/collection'
        require_relative '../../../services/importer/lib/importer/datasource_downloader'
        Severity: Minor
        Found in app/models/synchronization/member.rb - About 7 hrs to fix

          File user_metadata_export_service.rb has 490 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'json'
          require 'carto/export/layer_exporter'
          require 'carto/export/data_import_exporter'
          require_dependency 'carto/export/connector_configuration_exporter'
          
          
          Severity: Minor
          Found in app/services/carto/user_metadata_export_service.rb - About 7 hrs to fix

            Method update has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                valid_password_confirmation
                session[:show_dashboard_details_flash] = params[:show_dashboard_details_flash].present?
                session[:show_account_settings_flash] = params[:show_account_settings_flash].present?
            
            
            Severity: Minor
            Found in app/controllers/admin/organization_users_controller.rb - About 7 hrs to fix

            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

            exports has 52 functions (exceeds 20 allowed). Consider refactoring.
            Open

            module.exports = CoreView.extend({
              className: 'CDB-Widget-body',
            
              defaults: {
                chartHeight: 48 + 20 + 4

              Class UserTable has 52 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class UserTable < ActiveRecord::Base
              
                  attr_accessor :skip_destroy_dependent_visualizations
              
                  PRIVACY_PRIVATE = 0
              Severity: Major
              Found in app/models/carto/user_table.rb - About 7 hrs to fix

                Class ApplicationController has 52 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class ApplicationController < ActionController::Base
                
                  include UrlHelper
                  include Carto::ControllerHelper
                  include Carto::Common::ControllerHelper
                Severity: Major
                Found in app/controllers/application_controller.rb - About 7 hrs to fix

                  Class Permission has 51 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Carto::Permission < ActiveRecord::Base
                  
                    class Error < StandardError; end
                  
                    DEFAULT_ACL_VALUE = [].freeze
                  Severity: Major
                  Found in app/models/carto/permission.rb - About 7 hrs to fix

                    MapOverlays has 50 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    cdb.admin.MapOverlays = cdb.core.View.extend({
                    
                      initialize: function() {
                        this.overlayViews = [];
                        this.horizontal_overlays = ["share", "layer_selector", "search"];
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/table/overlays/map_overlays.js - About 7 hrs to fix

                      Method data has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def data(options = {})
                              return {} if @user.nil?
                              db_size_in_bytes = @user.db_size_in_bytes
                      
                              data = {
                      Severity: Minor
                      Found in app/controllers/carto/api/user_presenter.rb - About 6 hrs to fix

                      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 catalog.js has 454 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import 'whatwg-fetch';
                      
                      import { setUrlParameters } from 'new-dashboard/utils/catalog/url-parameters';
                      import { getBaseURL } from 'new-dashboard/utils/catalog/base-url';
                      import { getMetricsBaseURL } from '../../utils/catalog/base-url';
                      Severity: Minor
                      Found in lib/assets/javascripts/new-dashboard/store/actions/catalog.js - About 6 hrs to fix

                        File editor.js has 454 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        var ACTIVE_LOCALE = window.ACTIVE_LOCALE;
                        if (ACTIVE_LOCALE !== 'en') {
                          require('moment/locale/' + ACTIVE_LOCALE);
                        }
                        var Locale = require('locale/index');
                        Severity: Minor
                        Found in lib/assets/javascripts/builder/editor.js - About 6 hrs to fix

                          File permission.rb has 452 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'active_record'
                          require_dependency 'cartodb/errors'
                          
                          class Carto::Permission < ActiveRecord::Base
                          
                          
                          Severity: Minor
                          Found in app/models/carto/permission.rb - About 6 hrs to fix

                            File analyses.js has 447 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            var _ = require('underscore');
                            var camshaftReference = require('./camshaft-reference');
                            var AreaOfInfluenceFormModel = require('builder/editor/layers/layer-content-views/analyses/analysis-form-models/area-of-influence-form-model');
                            var AggregateIntersectionFormModel = require('builder/editor/layers/layer-content-views/analyses/analysis-form-models/aggregate-intersection-form-model');
                            var FilterIntersectionFormModel = require('builder/editor/layers/layer-content-views/analyses/analysis-form-models/filter-intersection-form-model');
                            Severity: Minor
                            Found in lib/assets/javascripts/builder/data/analyses.js - About 6 hrs to fix

                              File wizard.js has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // form validation
                              
                              var alwaysTrueValidator = function(form) { return true };
                              
                              function columnExistsValidatorFor(column_name) {
                              Severity: Minor
                              Found in lib/assets/javascripts/cartodb/models/wizard.js - About 6 hrs to fix

                                File data-layer-view.js has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                var Backbone = require('backbone');
                                var _ = require('underscore');
                                var CoreView = require('backbone/core-view');
                                var template = require('./data-layer.tpl');
                                var fetchingTemplate = require('./data-layer-fetching.tpl');

                                  Method data has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def data(options = {})
                                          return {} if @user.nil?
                                          db_size_in_bytes = @user.db_size_in_bytes
                                  
                                          data = {
                                  Severity: Major
                                  Found in app/controllers/carto/api/user_presenter.rb - About 6 hrs to fix

                                    Function tokenBase has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function tokenBase (stream, state) {
                                          var ch = stream.next();
                                    
                                          if (ch === '@') {
                                            stream.eatWhile(/[\w\-]/);
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language