CartoDB/cartodb20

View on GitHub

Showing 2,455 of 5,951 total issues

File actions_menu.js has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open


  /**
   *  Actions menu view, aka LayersPanel
   *
   *  - It needs at least visualization and user models.
Severity: Minor
Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 6 hrs to fix

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

        def data(options = {})
          db_size_in_bytes = self.db_size_in_bytes
    
          data = {
            id: id,
    Severity: Minor
    Found in app/models/user/user_decorator.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

    LayerPanelView has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

      cdb.admin.LayerPanelView = cdb.admin.RightMenu.extend({
    
        _TEXTS: {
          error:  {
            default:  _t('Something went wrong, try again later')
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/table/layer_panel_view.js - About 6 hrs to fix

      CartoTableMetadata has 46 functions (exceeds 20 allowed). Consider refactoring.
      Open

      const CartoTableMetadata = Base.extend({
        currentLoading: 0, // class variable (shared). I'm still not sure if this is messy as hell or powerfull as a transformer
      
        _TEXTS: {
          columnDeleted: 'Your column has been deleted',

        File annotation.js has 429 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        cdb.admin.overlays.Annotation = cdb.geo.ui.Annotation.extend({
        
          className: "annotation overlay",
        
          template_name: 'table/views/overlays/annotation',
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/overlays/annotation.js - About 6 hrs to fix

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

          module.exports = function (CodeMirror) {
            /*eslint-disable */
            var Pos = CodeMirror.Pos;
          
            function SearchCursor(doc, query, pos, caseFold) {

            Class Organization has 45 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Organization < ActiveRecord::Base
            
                include CartodbCentralSynchronizable
                include DataServicesMetricsHelper
                include Carto::OrganizationQuotas
            Severity: Minor
            Found in app/models/carto/organization.rb - About 6 hrs to fix

              Class Layer has 45 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Layer < ActiveRecord::Base
                  include Carto::TableUtils
                  include LayerTableDependencies
                  include Carto::QueryRewriter
              
              
              Severity: Minor
              Found in app/models/carto/layer.rb - About 6 hrs to fix

                File application_controller.rb has 423 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require_relative '../../lib/cartodb/profiler.rb'
                require_dependency 'carto/authentication_manager'
                require_dependency 'carto/http_header_authentication'
                
                class ApplicationController < ActionController::Base
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 6 hrs to fix

                  Function exports has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function (CodeMirror) {
                    CodeMirror.defineMode('mustache', function () {
                      return {
                        token: function (stream, state) {
                          var ch;

                  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 public_map has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def public_map
                      if current_user.nil? && !request.params[:redirected].present?
                        redirect_url = get_corrected_url_if_proceeds(for_table=false)
                        unless redirect_url.nil?
                          redirect_to redirect_url and return
                  Severity: Minor
                  Found in app/controllers/admin/visualizations_controller.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 visualizations_controller.rb has 417 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_relative 'visualization_presenter'
                  require_dependency 'carto/api/vizjson_presenter'
                  require_relative '../../../models/visualization/stats'
                  require_relative 'paged_searcher'
                  require_relative '../controller_helper'
                  Severity: Minor
                  Found in app/controllers/carto/api/visualizations_controller.rb - About 6 hrs to fix

                    Function _barChart has 150 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _barChart: function() {
                    
                          var self = this;
                    
                          var

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

                      module.exports = (function () {
                        var initialized = false;
                        var routeModel = new Backbone.Model();
                        // keep last route before a modal, so we can replace /modal with it
                        var previousRoute;
                      Severity: Major
                      Found in lib/assets/javascripts/builder/routes/router.js - About 6 hrs to fix

                        Function draggableOverlay has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                        Open

                        $.fn.draggableOverlay = function(opt) {
                        
                          var self      = this;
                          var $rule     = null;
                          var $ruleH    = null;
                        Severity: Minor
                        Found in lib/assets/javascripts/utils/draggable.js - About 5 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 mustache.js has 413 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*!
                         * mustache.js - Logic-less {{mustache}} templates with JavaScript
                         * http://github.com/janl/mustache.js
                         */
                        
                        
                        Severity: Minor
                        Found in lib/build/mustache.js - About 5 hrs to fix

                          Function GrouperLayerMapView has 147 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function GrouperLayerMapView(mapViewClass) {
                          
                            return {
                          
                              initialize: function() {
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/table/mapview.js - About 5 hrs to fix

                            File table-body-view.js has 410 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            var CoreView = require('backbone/core-view');
                            var $ = require('jquery');
                            var _ = require('underscore');
                            var Clipboard = require('clipboard');
                            var TableBodyRowView = require('./table-body-row-view');

                              UserModel has 43 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              var UserModel = Backbone.Model.extend({
                                urlRoot: function () {
                                  var baseUrl = this._configModel.get('base_url');
                                  return baseUrl + '/api/v1/users';
                                },
                              Severity: Minor
                              Found in lib/assets/javascripts/builder/data/user-model.js - About 5 hrs to fix

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

                                module.exports = TableDataCollection.extend({
                                  _ADDED_ROW_TEXT: 'Row added correctly',
                                  _ADDING_ROW_TEXT: 'Adding a new row',
                                  _GEOMETRY_UPDATED: 'Table geometry updated',
                                
                                
                                Severity: Minor
                                Found in lib/assets/javascripts/dashboard/data/table/carto-table-data.js - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language