CartoDB/cartodb20

View on GitHub

Showing 2,455 of 5,951 total issues

Function validate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  validate: function(attrs) {
    if (!attrs) return;

    if (attrs.type === "file") {
      // Number of files

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 36 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (CodeMirror) {
  var Pos = CodeMirror.Pos;

  function arrayContains (arr, item) {
    return arr.indexOf(item) !== -1;

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

  validate: function (attrs) {
    if (!attrs) return;

    if (attrs.type === 'file') {
      // Number of files
Severity: Minor
Found in lib/assets/javascripts/builder/data/upload-model.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

Function FileTrie has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

var FileTrie = function () {
  var trie = {
    root: {}
  };

Severity: Minor
Found in lib/build/affectedFiles/fileTrie.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

Method create has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    account_creator = CartoDB::UserAccountCreator.new(Carto::UserCreation::CREATED_VIA_ORG_SIGNUP).
                      with_organization(@organization, viewer: invitation.try(:viewer)).
                      with_invitation_token(params[:invitation_token])

Severity: Minor
Found in app/controllers/signup_controller.rb - 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

Method process has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

      def process(input_data, add_headers = true, additional_fields = {})
        results = []

        if add_headers
          results_row = INDIVIDUAL_FIELDS.map { |field|
Severity: Minor
Found in services/twitter-search/lib/twitter-search/json_to_csv_converter.rb - 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

Method import_user has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

      def import_user
        begin
          if @options[:metadata]
            check_user_exists_redis
            check_user_exists_postgres
Severity: Minor
Found in services/user-mover/import_user.rb - 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 visualizations_export_service_2.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'json'
require_dependency 'carto/export/layer_exporter'
require_dependency 'carto/export/data_import_exporter'

# Version History
Severity: Minor
Found in app/services/carto/visualizations_export_service_2.rb - About 5 hrs to fix

    File show-hint.code-mirror.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // CodeMirror, copyright (c) by Marijn Haverbeke and others
    // Distributed under an MIT license: http://codemirror.net/LICENSE
    
    /* eslint-disable */
    module.exports = function (CodeMirror) {

      File events.rb has 389 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'carto/tracking/services/pubsub_tracker'
      
      require_dependency 'carto/tracking/formats/internal'
      require_dependency 'carto/tracking/services/pubsub'
      require_dependency 'carto/tracking/services/segment'
      Severity: Minor
      Found in lib/carto/tracking/events.rb - About 5 hrs to fix

        Class ConnectionManager has 40 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class ConnectionManager
        
            class ConnectionNotFoundError < CartoError
        
              def initialize(message)
        Severity: Minor
        Found in lib/carto/connector/connection_manager.rb - About 5 hrs to fix

          Function draggableOverlay has 133 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          $.fn.draggableOverlay = function(opt) {
          
            var self      = this;
            var $rule     = null;
            var $ruleH    = null;
          Severity: Major
          Found in lib/assets/javascripts/utils/draggable.js - About 5 hrs to fix

            Function generate_categories has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

              generate_categories: function(props, table, metadata, property_name) {
                property_name = property_name || props['property'];
            
                function _normalizeValue(v) {
                  return v.replace(/\n/g,'\\n')
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/models/carto/category.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

            Method initialize has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(options)
                    default_options = { metadata: true, data: true, split_user_schemas: true, path: '', set_banner: true }
                    @options = default_options.merge(options)
            
                    @start = Time.now
            Severity: Minor
            Found in services/user-mover/export_user.rb - 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 text.js has 383 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File collection.rb has 382 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'set'
              require_relative './member'
              require_relative './overlays'
              require_relative '../../../services/data-repository/structures/collection'
              
              
              Severity: Minor
              Found in app/models/visualization/collection.rb - About 5 hrs to fix

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

                module.exports = CoreView.extend({
                
                  events: {
                    'click .js-addIcon': '_onAddIconClicked',
                    'click .js-selectAllIcons': '_onSelectAllIconsClicked',

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

                  class UserTable < Sequel::Model
                    extend Forwardable
                  
                    INTERFACE = %w{
                      pk
                  Severity: Minor
                  Found in app/models/table/user_table.rb - About 5 hrs to fix

                    Class SessionsController has 39 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class SessionsController < ApplicationController
                      include ActionView::Helpers::DateHelper
                      include LoginHelper
                      include Carto::EmailCleaner
                    
                    
                    Severity: Minor
                    Found in app/controllers/sessions_controller.rb - About 5 hrs to fix

                      Class Ogr2ogr has 39 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Ogr2ogr
                            ENCODING  = 'UTF-8'
                            SCHEMA    = 'cdb_importer'
                      
                            PG_COPY_OPTION        = { 'PG_USE_COPY' => 'YES' }.freeze
                      Severity: Minor
                      Found in services/importer/lib/importer/ogr2ogr.rb - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language