CartoDB/cartodb20

View on GitHub

Showing 5,951 of 5,951 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module.exports = CoreView.extend({
  initialize: function (options) {
    checkAndBuildOpts(options, REQUIRED_OPTS, this);

    this._initViews();
lib/assets/javascripts/dashboard/views/account/account-main-view.js on lines 19..74

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 504.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Class User has 148 methods (exceeds 20 allowed). Consider refactoring.
Open

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

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

    require 'cartodb/per_request_sequel_cache'
    require 'cartodb-common'
    require 'email_address'
    require 'securerandom'
    require_relative './user/user_decorator'
    Severity: Major
    Found in app/models/user.rb - About 2 days to fix

      Class Visualization has 136 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

        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

          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: [

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

              class Table
                extend Forwardable
                include Carto::TableUtils
                include ::LoggerHelper
              
              
              Severity: Major
              Found in app/models/table.rb - About 2 days to fix

                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: [

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

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

                    Class DBService has 111 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class DBService
                          include CartoDB::MiniSequel
                          include Carto::Configuration
                          include ::LoggerHelper
                          extend CartoDB::SequelConnectionHelper
                    Severity: Major
                    Found in app/models/user/db_service.rb - About 2 days to fix

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                        render: function() {
                          var title = this.options.fileAttrs.title && this.model.get('value')[this.options.fileAttrs.title] || this.model.get('value');
                          var description = this._genDescription();
                          var ext = this.options.fileAttrs.ext ? Utils.getFileExtension(title) : '' ;
                      
                      
                      lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_bigquery_selected_dataset_view.js on lines 14..41

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 368.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                        render: function() {
                          var title = this.options.fileAttrs.title && this.model.get('value')[this.options.fileAttrs.title] || this.model.get('value');
                          var description = this._genDescription();
                          var ext = this.options.fileAttrs.ext ? Utils.getFileExtension(title) : '' ;
                      
                      
                      lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_selected_dataset_view.js on lines 55..82

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 368.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                      /**
                       * models for cartodb admin
                       */
                      
                      (function() {
                      Severity: Major
                      Found in lib/assets/javascripts/cartodb/models/table.js - About 2 days to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        module.exports = {
                          icons: [
                            { kind: "pattern", ext: "png", name: 'diagonal_1px_fast', icon: 'diagonal_1px_fast'},
                            { kind: "pattern", ext: "png", name: 'diagonal_1px_med', icon: 'diagonal_1px_med', },
                            { kind: "pattern", ext: "png", name: 'diagonal_1px_slow', icon: 'diagonal_1px_slow'},
                        lib/assets/javascripts/builder/components/input-color/assets/pattern-icons.js on lines 1..19

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 348.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        module.exports = {
                          icons: [
                            { kind: 'pattern', ext: 'png', name: 'diagonal_1px_fast', icon: 'diagonal_1px_fast' },
                            { kind: 'pattern', ext: 'png', name: 'diagonal_1px_med', icon: 'diagonal_1px_med' },
                            { kind: 'pattern', ext: 'png', name: 'diagonal_1px_slow', icon: 'diagonal_1px_slow' },
                        lib/assets/javascripts/cartodb/common/dialogs/map/image_picker/data/patterns.js on lines 1..19

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 348.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

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

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

                          
                          
                          carto_quotables = [
                            'text-face-name'
                          ];
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 day to fix

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

                                class Member
                                  extend Forwardable
                                  include Virtus.model
                                  include CacheHelper
                                  include Carto::VisualizationDependencies
                            Severity: Major
                            Found in app/models/visualization/member.rb - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language