CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/table/overlays/text.js

Summary

Maintainability
F
1 wk
Test Coverage

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

    Text has 26 functions (exceeds 20 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 3 hrs to fix

      Function _onKeyDown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        _onKeyDown: function(e) {
      
          var selected = this.model.get("selected");
      
          if (selected) {
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 2 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 _savePosition has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _savePosition: function(editable) {
      
          var extra = this.model.get("extra");
      
          var x     = this.model.get("x");
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr to fix

        Function _savePosition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          _savePosition: function(editable) {
        
            var extra = this.model.get("extra");
        
            var x     = this.model.get("x");
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr 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 _applyStyle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _applyStyle: function(save) {
        
            var style      = this.model.get("style");
        
            var boxColor   = style["box-color"];
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr to fix

          Function _place has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _place: function() {
          
              var mode  = this.editModel.get("mode");
              var extra = this.model.get("extra");
          
          
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

               if (oldX === x && y === oldY || x === 0 && landscape_dominant_side === "right" && y === oldY || y == 0 && portrait_dominant_side === "bottom" && oldX === x) {
            
                  moved = false;
            
                  this.$el.addClass("selected");
            Severity: Critical
            Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr to fix

              Function _disableEditingMode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _disableEditingMode: function() {
              
                  $(document).unbind('keydown', this._onKeyDown);
              
                  var text = this._transformToMarkdown(this.model.get("text"));
              Severity: Minor
              Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 1 hr to fix

                Function _applyStyle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  _applyStyle: function(save) {
                
                    var style      = this.model.get("style");
                
                    var boxColor   = style["box-color"];
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 55 mins 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 _place has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  _place: function() {
                
                    var mode  = this.editModel.get("mode");
                    var extra = this.model.get("extra");
                
                
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js - About 25 mins 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

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

                  _enableEditingMode: function() {
                
                    this.$el
                    .addClass("editable")
                    .addClass("disabled");
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 6 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 555..572

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

                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

                    if      (fontFamily  == "Droid Sans")       fontFamilyClass = "droid";
                    else if (fontFamily  == "Vollkorn")         fontFamilyClass = "vollkorn";
                    else if (fontFamily  == "Open Sans")        fontFamilyClass = "open_sans";
                    else if (fontFamily  == "Roboto")           fontFamilyClass = "roboto";
                    else if (fontFamily  == "Lato")             fontFamilyClass = "lato";
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 4 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 439..446

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

                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

                  }, {
                    name: 'Box',
                    form: {
                      'box-color':   { type: 'color', value: '#000', extra: { tick: "left", picker_horizontal_position: "left", picker_vertical_position: "down" }},
                      'box-opacity': { type: 'simple_opacity', value: .7, min:0, max:1, inc: .1, disable_triggering: true },
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 4 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 54..61

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

                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

                  _transformToMarkdown: function(text) {
                
                    text = markdown.toHTML(text)
                
                    text = text.replace(/&lt;/g, "<");
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 3 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 621..633

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

                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

                    if (portrait_dominant_side === 'bottom') {
                
                      this.$el.offset({
                        bottom: extra.bottom_position
                      });
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 3 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/text.js on lines 547..565

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

                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

                    if (landscape_dominant_side === 'right') {
                
                      this.$el.offset({
                        right: extra.right_position
                      });
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 3 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/text.js on lines 527..545

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

                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 3 locations. Consider refactoring.
                Open

                    var rgbaCol = 'rgba(' + parseInt(boxColor.slice(-6,-4),16)
                    + ',' + parseInt(boxColor.slice(-4,-2),16)
                    + ',' + parseInt(boxColor.slice(-2),16)
                    +', ' + boxOpacity + ' )';
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 2 other locations - About 2 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 320..323
                lib/assets/javascripts/cartodb/table/overlays/image.js on lines 157..160

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

                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 3 locations. Consider refactoring.
                Open

                  _onChangeMode: function() {
                
                    var mode = this.editModel.get("mode");
                
                    this.trigger('editing', mode === 'editable', this);
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 2 other locations - About 2 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 542..553
                lib/assets/javascripts/cartodb/table/overlays/image.js on lines 322..334

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

                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 3 locations. Consider refactoring.
                Open

                  _onChangeExtra: function() {
                
                    var extra  = this.model.get("extra");
                    extra.text = this.model.get("text");
                
                
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 2 other locations - About 2 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 384..391
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 295..302

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

                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 3 locations. Consider refactoring.
                Open

                  _onPaste: function(e) {
                
                    var self = this;
                
                    setTimeout(function() {
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 2 other locations - About 2 hrs to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 176..187
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 132..143

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

                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

                  _onKeyUp: function(e) {
                
                    if (this.timeout) {
                      clearTimeout(this.timeout);
                    }
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 125..133

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

                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

                    this.$el
                    .removeClass("droid")
                    .removeClass("vollkorn")
                    .removeClass("roboto")
                    .removeClass("open_sans")
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 448..456

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

                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 3 locations. Consider refactoring.
                Open

                  _onMouseEnter: function() {
                
                    this.$el.addClass("hover");
                
                    if (this.editModel.get("mode") === "editable") {
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 2 other locations - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 245..253
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 218..225

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

                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 4 locations. Consider refactoring.
                Open

                  _onChangeDisplay: function() {
                
                    var display = this.model.get("display");
                
                    if (display) {
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 3 other locations - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 283..293
                lib/assets/javascripts/cartodb/table/overlays/header.js on lines 103..113
                lib/assets/javascripts/cartodb/table/overlays/logo.js on lines 58..68

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

                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

                   if (oldX === x && y === oldY || x === 0 && landscape_dominant_side === "right" && y === oldY || y == 0 && portrait_dominant_side === "bottom" && oldX === x) {
                
                      moved = false;
                
                      this.$el.addClass("selected");
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/code.js on lines 169..176

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

                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 8 locations. Consider refactoring.
                Open

                  _close: function(e) {
                
                    this.killEvent(e);
                
                    var self = this;
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 7 other locations - About 1 hr to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 331..341
                lib/assets/javascripts/cartodb/table/overlays/fullscreen.js on lines 92..102
                lib/assets/javascripts/cartodb/table/overlays/layer_selector.js on lines 140..150
                lib/assets/javascripts/cartodb/table/overlays/loader.js on lines 103..113
                lib/assets/javascripts/cartodb/table/overlays/search.js on lines 114..124
                lib/assets/javascripts/cartodb/table/overlays/share.js on lines 109..121
                lib/assets/javascripts/cartodb/table/overlays/zoom.js on lines 131..141

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

                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

                      if (!focus) {
                        if (e.which == 67 && (e.ctrlKey || e.metaKey)) {
                          this.trigger('duplicate', this.model, this);
                        }
                      }
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 50 mins to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 163..167

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

                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

                  }, {
                    name: 'Max Width',
                    form: {
                      'box-width':  { type: 'simple_number', value: 300, min: 50, max: 2000, inc: 10, disable_triggering: true },
                    }
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 40 mins to fix
                lib/assets/javascripts/cartodb/table/overlays/image.js on lines 39..45

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

                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 5 locations. Consider refactoring.
                Open

                  events: {
                
                    "mouseenter .text":  "_onMouseEnter",
                
                    "click .close":      "_close",
                Severity: Major
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 4 other locations - About 35 mins to fix
                lib/assets/javascripts/cartodb/table/export_image_view.js on lines 10..19
                lib/assets/javascripts/cartodb/table/layer_panel_view.js on lines 31..40
                lib/assets/javascripts/cartodb/table/menu_modules/filters/selection.js on lines 87..96
                lib/assets/javascripts/cartodb/table/overlays/image.js on lines 5..18

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

                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

                  _onCloseDialogs: function() {
                    if (this.model.get("selected") !== undefined) this.model.set("selected", false);
                  },
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/table/overlays/text.js and 1 other location - About 35 mins to fix
                lib/assets/javascripts/cartodb/table/overlays/annotation.js on lines 635..637

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

                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

                There are no issues that match your filters.

                Category
                Status