CartoDB/cartodb20

View on GitHub

Showing 6,625 of 6,625 total issues

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

module.exports = CoreView.extend({

  events: {
    'click .js-back': '_onClickBack'
  },
lib/assets/javascripts/builder/components/input-color/assets-picker/user-assets-list-view.js on lines 192..204

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 1909.

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

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

    module.exports = {
      green: {
        '3': ['#E5F5F9', '#99D8C9', '#2CA25F'],
        '4': ['#EDF8FB', '#B2E2E2', '#66C2A4', '#238B45'],
        '5': ['#EDF8FB', '#B2E2E2', '#66C2A4', '#2CA25F', '#006D2C'],
    lib/assets/javascripts/cartodb/models/color_ramps.js on lines 5..134

    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 1101.

    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

    cdb.admin.color_ramps = {
      green: {
       '3': ['#E5F5F9', '#99D8C9', '#2CA25F'],
       '4': ['#EDF8FB', '#B2E2E2', '#66C2A4', '#238B45'],
       '5': ['#EDF8FB', '#B2E2E2', '#66C2A4', '#2CA25F', '#006D2C'],
    Severity: Major
    Found in lib/assets/javascripts/cartodb/models/color_ramps.js and 1 other location - About 6 days to fix
    lib/assets/javascripts/builder/components/input-color/input-quantitative-ramps/ramps.js on lines 1..128

    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 1101.

    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 = cdb.core.View.extend({
    
      className: 'AssetPane',
    
      events: {
    lib/assets/javascripts/cartodb/common/dialogs/map/image_picker/box_view.js on lines 5..131

    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 1016.

    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 = cdb.core.View.extend({
    
      className: 'AssetPane',
    
      events: {
    lib/assets/javascripts/cartodb/common/dialogs/map/image_picker/dropbox_view.js on lines 5..131

    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 1016.

    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

    module.exports = Backbone.Model.extend({
      defaults: {
        total_count: 0,
        per_page: 10,
        current_page: 1,
    lib/assets/javascripts/cartodb/common/views/pagination/model.js on lines 7..114

    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 852.

    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

    module.exports = cdb.core.Model.extend({
      defaults: {
        total_count:          0,
        per_page:             10,
        current_page:         1,
    lib/assets/javascripts/builder/components/pagination/pagination-model.js on lines 7..114

    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 852.

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

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

        validate: function (attrs) {
          if (!attrs) return;
      
          if (attrs.type === 'file') {
            // Number of files
      Severity: Major
      Found in lib/assets/javascripts/builder/data/upload-model.js and 1 other location - About 4 days to fix
      lib/assets/javascripts/dashboard/data/upload-model.js on lines 8..118

      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 730.

      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

        validate: function (attrs) {
          if (!attrs) return;
      
          if (attrs.type === 'file') {
            // Number of files
      Severity: Major
      Found in lib/assets/javascripts/dashboard/data/upload-model.js and 1 other location - About 4 days to fix
      lib/assets/javascripts/builder/data/upload-model.js on lines 94..204

      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 730.

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

      File user.rb has 1564 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 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
                Severity
                Category
                Status
                Source
                Language