CartoDB/cartodb20

View on GitHub

Showing 2,455 of 5,951 total issues

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

module.exports = Table.extend({

  classLabel: 'cdb.admin.TableView',

  events: CoreView.extendEvents({

    File assets-view.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var $ = require('jquery');
    var _ = require('underscore');
    var CoreView = require('backbone/core-view');
    var Backbone = require('backbone');
    
    

      File arcgis.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'json'
      require 'addressable/uri'
      require_relative '../base_direct_stream'
      require_relative '../../../../../lib/carto/http/client'
      
      
      Severity: Minor
      Found in services/datasources/lib/datasources/url/arcgis.rb - About 4 hrs to fix

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

        cdb.admin.overlays.Code = cdb.core.View.extend({
        
          className: "code overlay",
        
          template_name: 'table/views/overlays/code',
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/overlays/code.js - About 4 hrs to fix

          Function _extract has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

            _extract: function(method, extractVariables) {
              var columns = [];
              if (this.ruleset) {
                var definitions = this.ruleset.toList(this.parse_env);
                for (var d in definitions) {
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/models/carto.js - About 4 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

          Function _onWizardChange has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

            _onWizardChange: function(m) {
          
              var wizardProperties = m.attributes;
              var previousWizardProperties = m.previousAttributes();
          
          

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

            def insert_row!(raw_attributes)
              primary_key = nil
              owner.in_database do |user_database|
                schema = user_database.schema(name, schema: owner.database_schema, reload: true).map{|c| c.first}
                raw_attributes.delete(:id) unless schema.include?(:id)
          Severity: Minor
          Found in app/models/table.rb - About 4 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

          Method public_table has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

            def public_table
              return(render_pretty_404) if @visualization.private?
          
              if @visualization.derived?
                if current_user.nil? || current_user.username != request.params[:user_domain]
          Severity: Minor
          Found in app/controllers/admin/visualizations_controller.rb - About 4 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 carto_editor.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          
            /**
             *  Carto CSS editor module
             *
             *  new cdb.admin.mod.CartoCSSEditor({
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/table/menu_modules/carto_editor.js - About 4 hrs to fix

            File histogram.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            (function() {
            
              /*
              * Filter's model
              *

              Class Member has 36 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Member
              
                    include ::LoggerHelper
                    include Carto::Configuration
                    include Virtus.model
              Severity: Minor
              Found in app/models/synchronization/member.rb - About 4 hrs to fix

                Class Column has 36 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Column
                      DEFAULT_SRID    = 4326
                      WKB_RE          = /^\d{2}/
                      GEOJSON_RE      = /{.*(type|coordinates).*(type|coordinates).*}/m
                      WKT_RE          = /POINT|LINESTRING|POLYGON/
                Severity: Minor
                Found in services/importer/lib/importer/column.rb - About 4 hrs to fix

                  File sessions_controller.rb has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_dependency 'carto/oauth/github/config'
                  require_dependency 'carto/oauth/google/config'
                  require_dependency 'carto/saml_service'
                  require_dependency 'carto/username_proposer'
                  require_dependency 'carto/email_cleaner'
                  Severity: Minor
                  Found in app/controllers/sessions_controller.rb - About 4 hrs to fix

                    File vizjson3_presenter.rb has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require_dependency 'carto/api/layer_vizjson_adapter'
                    require_dependency 'carto/api/infowindow_migrator'
                    require_dependency 'cartodb/redis_vizjson_cache'
                    require_dependency 'carto/named_maps/template'
                    require_dependency 'carto/legend_migrator'
                    Severity: Minor
                    Found in app/controllers/carto/api/vizjson3_presenter.rb - About 4 hrs to fix

                      Method normalize has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def normalize(string, transliterate_cyrillic: false)
                              return '' if string.nil? || string.empty?
                      
                              n = string.force_encoding("UTF-8")
                              n.gsub!(/[àáâãäåāă]/,    'a')
                      Severity: Major
                      Found in services/importer/lib/importer/string_sanitizer.rb - About 4 hrs to fix

                        File xml.codemirror.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        (function(mod) {
                          if (typeof exports == "object" && typeof module == "object") // CommonJS
                            mod(require("../../lib/codemirror"));
                          else if (typeof define == "function" && define.amd) // AMD
                            define(["../../lib/codemirror"], mod);
                        Severity: Minor
                        Found in lib/assets/javascripts/utils/xml.codemirror.js - About 4 hrs to fix

                          File user_commons.rb has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require_dependency 'carto/helpers/batch_queries_statement_timeout'
                          require_dependency 'carto/helpers/billing'
                          require_dependency 'carto/helpers/google_maps'
                          require_dependency 'carto/helpers/has_connector_configuration'
                          require_dependency 'carto/helpers/limits'
                          Severity: Minor
                          Found in app/models/carto/helpers/user_commons.rb - About 4 hrs to fix

                            Method valid? has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def valid?
                                    validator.errors.store(:type, "Visualization type is not valid") unless valid_type?
                                    validator.errors.store(:user, "Viewer users can't store visualizations") if user.viewer
                            
                                    validator.validate_presence_of(name: name, privacy: privacy, type: type, user_id: user_id)
                            Severity: Minor
                            Found in app/models/visualization/member.rb - About 4 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

                            Annotation has 35 functions (exceeds 20 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 4 hrs to fix

                              Mobile has 35 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              cdb.admin.overlays.Mobile = cdb.core.View.extend({
                              
                                className: "cartodb-mobile",
                              
                                template_name: "table/views/mobile",
                              Severity: Minor
                              Found in lib/assets/javascripts/cartodb/table/overlays/mobile.js - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language