CartoDB/cartodb20

View on GitHub

Showing 2,474 of 6,540 total issues

File legacy_functions.rb has 2539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module CartoDB
  module DataMover
    module LegacyFunctions
      # functions taken from https://github.com/postgis/postgis/blob/svn-trunk/utils/postgis_restore.pl.in#L473
      SIGNATURE_RE = /[\d\s;]*(?<type>(?:\S+\s?['class'|'family'|'aggregate'|'domain'|'function'|'cast'|'type']*))\s+(?:[^\s]\s+)?(?<name>[^\(]+)\s*(?:\((?<arguments>.*)\))?/i
Severity: Major
Found in services/user-mover/legacy_functions.rb - About 1 wk to fix

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

    module.exports = function (CodeMirror) {
      CodeMirror.defineMode('cartocss', function (config) {
        var indentUnit = config.indentUnit;
        var type;
    
    

    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 User has 240 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < Sequel::Model
      include CartoDB::MiniSequel
      include CartoDB::UserDecorator
      include Concerns::CartodbCentralSynchronizable
      include CartoDB::ConfigUtils
    Severity: Major
    Found in app/models/user.rb - About 4 days to fix

      File user.rb has 1566 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'cartodb/per_request_sequel_cache'
      require_relative './user/user_decorator'
      require_relative './user/oauths'
      require_relative './synchronization/synchronization_oauth'
      require_relative '../helpers/data_services_metrics_helper'
      Severity: Major
      Found in app/models/user.rb - About 4 days to fix

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

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

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

        module.exports = function (CodeMirror) {
          "use strict";
        
          var HINT_ELEMENT_CLASS        = "CodeMirror-hint";
          var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";

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

        var $ = require('jquery');
        var _ = require('underscore');
        var d3 = require('d3');
        var d3Interpolate = require('d3-interpolate');
        var CoreModel = require('backbone/core-model');
        Severity: Major
        Found in lib/assets/javascripts/deep-insights/widgets/histogram/chart.js - About 3 days to fix

          File db_service.rb has 1291 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_relative 'db_queries'
          require_dependency 'carto/db/database'
          require_dependency 'carto/db/user_schema_mover'
          require 'cartodb/sequel_connection_helper'
          require 'carto/configuration'
          Severity: Major
          Found in app/models/user/db_service.rb - About 3 days to fix

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

            module.exports = function (params) {
              if (!params.userModel) throw new Error('userModel is required');
              if (!params.analysisDefinitionsCollection) throw new Error('analysisDefinitionsCollection is required');
              if (!params.analysisDefinitionNodesCollection) throw new Error('analysisDefinitionNodesCollection is required');
              if (!params.layerDefinitionsCollection) throw new Error('layerDefinitionsCollection is required');
            Severity: Major
            Found in lib/assets/javascripts/builder/data/user-actions.js - About 3 days to fix

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

              module.exports = function (params) {
                if (!params.userModel) throw new Error('userModel is required');
                if (!params.analysisDefinitionsCollection) throw new Error('analysisDefinitionsCollection is required');
                if (!params.analysisDefinitionNodesCollection) throw new Error('analysisDefinitionNodesCollection is required');
                if (!params.layerDefinitionsCollection) throw new Error('layerDefinitionsCollection is required');
              Severity: Minor
              Found in lib/assets/javascripts/builder/data/user-actions.js - About 3 days 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 mapview.js has 1200 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * map tab shown in cartodb admin
               */
              
              /**
              Severity: Major
              Found in lib/assets/javascripts/cartodb/table/mapview.js - About 3 days to fix

                File table.rb has 1194 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'forwardable'
                
                require_relative './table/column_typecaster'
                require_relative './table/privacy_manager'
                require_relative './table/relator'
                Severity: Major
                Found in app/models/table.rb - About 3 days to fix

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

                  module.exports = function(CodeMirror) {
                  "use strict";
                  
                  CodeMirror.defineMode("sql", function(config, parserConfig) {
                    "use strict";
                  Severity: Minor
                  Found in lib/assets/javascripts/builder/components/code-mirror/mode/sql.js - About 2 days 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 common_passwords.rb has 1004 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Carto
                    module CommonPasswords
                      COMMON_PASSWORDS = ['123456',
                                          'password',
                                          '12345678',
                  Severity: Major
                  Found in lib/carto/common_passwords.rb - About 2 days to fix

                    File data_import.rb has 976 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'sequel'
                    require 'fileutils'
                    require 'uuidtools'
                    require_relative './user'
                    require_relative './table'
                    Severity: Major
                    Found in app/models/data_import.rb - About 2 days to fix

                      Class Visualization has 124 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Carto::Visualization < ActiveRecord::Base
                        include CacheHelper
                        include Carto::UUIDHelper
                        include Carto::AuthTokenGenerator
                        include Carto::VisualizationDependencies
                      Severity: Major
                      Found in app/models/carto/visualization.rb - About 2 days to fix

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

                        module.exports = CoreView.extend({
                          options: {
                            // render the chart once the width is set as default, provide false value for this prop to disable this behavior
                            // e.g. for "mini" histogram behavior
                            showOnWidthChange: true,
                        Severity: Major
                        Found in lib/assets/javascripts/deep-insights/widgets/histogram/chart.js - About 2 days to fix

                          File maki_icons.js has 949 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // Maki icons from https://github.com/mapbox/maki
                          // and https://github.com/mapbox/maki/blob/mb-pages/_includes/maki.json
                          module.exports = {
                            disclaimer: '<a href="https://github.com/mapbox/maki" target="_blank">Maki Icons</a>, an open source project by <a href="http://mapbox.com" target="_blank">Mapbox</a>',
                            icons: [

                            File maki-icons.js has 941 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // Maki icons from https://github.com/mapbox/maki
                            // and https://github.com/mapbox/maki/blob/mb-pages/_includes/maki.json
                            module.exports = {
                              disclaimer: _t('assets.maki-icons.disclaimer'),
                              icons: [

                              Class Table has 116 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Table
                                extend Forwardable
                                include Carto::TableUtils
                              
                                # TODO Part of a service along with schema
                              Severity: Major
                              Found in app/models/table.rb - About 2 days to fix
                                Severity
                                Category
                                Status
                                Source
                                Language