livingsocial/rearview-engine

View on GitHub
public/rearview-src/js/view/addcategory.js

Summary

Maintainability
D
2 days
Test Coverage

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

        _moveAllCurrentMonitorsToCategory : function() {
            this.model.save({
                userId      : this.user.get('id'),
                name        : this.$el.find('#categoryName').val(),
                description : this.$el.find('#categoryDescription').val()
Severity: Minor
Found in public/rearview-src/js/view/addcategory.js - About 1 hr to fix

    Function _saveCategory has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _saveCategory : function(cb) {
                this._checkFirstCategoryCondition(function(currentDashboardModel) {
                    this.model = new DashboardModel({
                        category    : true,
                        dashboardId : this.dashboard.id
    Severity: Minor
    Found in public/rearview-src/js/view/addcategory.js - About 1 hr to fix

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

              setAddCategoryValidation : function() {
                  // grab form data
                  this.form = $('#addCategoryForm');
                  // set up form validation
                  this.validator = this.form.validate({
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 1 other location - About 1 day to fix
      public/rearview-src/js/view/adddashboard.js on lines 44..70

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

      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

              _cleanUp : function() {
                  this.$el.find('#categoryName').val('');
                  this.$el.find('#categoryDescription').val('');
                  this.$el.find('#categoryName').parent().removeClass('error');
                  this.validator.resetForm();
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 1 other location - About 3 hrs to fix
      public/rearview-src/js/view/adddashboard.js on lines 156..162

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

      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

              destructor : function() {
                  var $prevSibling = this.$el.prev();
      
                  this.remove();
                  this.off();
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 2 other locations - About 2 hrs to fix
      public/rearview-src/js/view/adddashboard.js on lines 102..111
      public/rearview-src/js/view/settings.js on lines 59..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 77.

      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.model.save({
                      userId      : this.user.get('id'),
                      name        : this.$el.find('#categoryName').val(),
                      description : this.$el.find('#categoryDescription').val()
                  }, {
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 1 other location - About 1 hr to fix
      public/rearview-src/js/view/addcategory.js on lines 203..207

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

                          this.model.save({
                              userId      : this.user.get('id'),
                              name        : this.$el.find('#categoryName').val(),
                              description : this.$el.find('#categoryDescription').val()
                          }, {
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 1 other location - About 1 hr to fix
      public/rearview-src/js/view/addcategory.js on lines 152..156

      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

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

                          Backbone.Mediator.pub('view:addcategory:save', {
                              'model'     : model,
                              'message'   : "The category '" + model.get('name') + "' was added.",
                              'attention' : 'Category Saved!'
                          });
      Severity: Minor
      Found in public/rearview-src/js/view/addcategory.js and 2 other locations - About 40 mins to fix
      public/rearview-src/js/view/addcategory.js on lines 209..213
      public/rearview-src/js/view/adddashboard.js on lines 133..137

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

      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

                                  Backbone.Mediator.pub('view:addcategory:save', {
                                      'model'     : model,
                                      'message'   : "The category '" + model.get('name') + "' was added.",
                                      'attention' : 'Category Saved!'
                                  });
      Severity: Minor
      Found in public/rearview-src/js/view/addcategory.js and 2 other locations - About 40 mins to fix
      public/rearview-src/js/view/addcategory.js on lines 158..162
      public/rearview-src/js/view/adddashboard.js on lines 133..137

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

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

              save : function() {
                  this._saveCategory(function() {
                      this._cleanUp();
                  }.bind(this));
              },
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 3 other locations - About 35 mins to fix
      public/rearview-src/js/view/addcategory.js on lines 111..115
      public/rearview-src/js/view/adddashboard.js on lines 86..90
      public/rearview-src/js/view/adddashboard.js on lines 96..100

      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

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

              saveFinish : function() {
                  this._saveCategory(function() {
                      this._closeModal();
                  }.bind(this));
              },
      Severity: Major
      Found in public/rearview-src/js/view/addcategory.js and 3 other locations - About 35 mins to fix
      public/rearview-src/js/view/addcategory.js on lines 101..105
      public/rearview-src/js/view/adddashboard.js on lines 86..90
      public/rearview-src/js/view/adddashboard.js on lines 96..100

      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