withassociates/slices

View on GitHub

Showing 74 of 74 total issues

Function SlicesController has 466 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  controller: function SlicesController() {

    // private vars
    var settings,
        busy = true;
Severity: Major
Found in app/assets/javascripts/slices/app/slices.js - About 2 days to fix

    AssetLibraryView has 58 functions (exceeds 20 allowed). Consider refactoring.
    Open

    slices.AssetLibraryView = Backbone.View.extend({
    
      DRAG_THRESHOLD: 15,
    
      DRAWER_HEIGHT: 250,
    Severity: Major
    Found in app/assets/javascripts/slices/app/views/asset_library_view.js - About 1 day to fix

      File slices.js has 491 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      //     Slices.js
      //     (c) 2011 With Associates
      //     http://slices.withassociates.com/
      
      var slices = {
      Severity: Minor
      Found in app/assets/javascripts/slices/app/slices.js - About 7 hrs to fix

        File asset_library_view.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // The asset library is dedicated to browsing, searching and managing of
        // assets. It can be rendered in-place, or to a specific element using the
        // helper method.
        //
        // To render the library inline in html:
        Severity: Minor
        Found in app/assets/javascripts/slices/app/views/asset_library_view.js - About 7 hrs to fix

          Function Page has 154 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function () {
          
              var settings,
                  pageId,
                  pageData,
          Severity: Major
          Found in app/assets/javascripts/slices/app/models/page.js - About 6 hrs to fix

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

              bind_prototypes: function() {
                this.collection_prototype = Backbone.Collection.extend(this.collection_prototype);
                this.view_prototype = Backbone.View.extend(this.view_prototype);
                this.model_prototype = Backbone.Model.extend(this.model_prototype);
                this.app_view_prototype.el = $('#container');
            Severity: Major
            Found in app/assets/javascripts/slices/app/backbones/entries.js and 1 other location - About 5 hrs to fix
            app/assets/javascripts/slices/app/backbones/admins.js on lines 99..105

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

            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

              bind_prototypes: function() {
                this.collection_prototype = Backbone.Collection.extend(this.collection_prototype);
                this.view_prototype = Backbone.View.extend(this.view_prototype);
                this.model_prototype = Backbone.Model.extend(this.model_prototype);
                this.app_view_prototype.el = $('#container');
            Severity: Major
            Found in app/assets/javascripts/slices/app/backbones/admins.js and 1 other location - About 5 hrs to fix
            app/assets/javascripts/slices/app/backbones/entries.js on lines 153..159

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

            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

                setup_search: function() {
                  var self = this;
                  setInterval(function() {
                    if ( self.search_now ) {
                      self.search_now = false;
            Severity: Major
            Found in app/assets/javascripts/slices/app/backbones/admins.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/slices/app/backbones/entries.js on lines 45..57

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

            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

                setup_search: function() {
                  var self = this;
                  setInterval(function() {
                    if ( self.search_now ) {
                      self.search_now = false;
            Severity: Major
            Found in app/assets/javascripts/slices/app/backbones/entries.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/slices/app/backbones/admins.js on lines 63..75

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

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

              controller: function SlicesController() {
            
                // private vars
                var settings,
                    busy = true;
            Severity: Minor
            Found in app/assets/javascripts/slices/app/slices.js - About 4 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

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

            Handlebars.registerHelper('dateField', function(options) {
              var view = new slices.DateFieldView({
                id         : slices.fieldId(this, options.hash.field),
                name       : options.hash.field,
                value      : this[options.hash.field],
            Severity: Major
            Found in app/assets/javascripts/slices/app/helpers/date_field.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/slices/app/helpers/url_field.js on lines 7..16

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

            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

            Handlebars.registerHelper('urlField', function(options) {
              var view = new slices.UrlFieldView({
                id         : slices.fieldId(this, options.hash.field),
                name       : options.hash.field,
                value      : this[options.hash.field],
            Severity: Major
            Found in app/assets/javascripts/slices/app/helpers/url_field.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/slices/app/helpers/date_field.js on lines 7..16

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

            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 onPageLoaded has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function onPageLoaded() {
                  var tabControls = $('#container-tab-controls'),
                      containersHolder = $('#containers-holder').empty(),
                      addSliceFields = $('#add-slice-fields');
            
            
            Severity: Major
            Found in app/assets/javascripts/slices/app/slices.js - About 3 hrs to fix

              AttachmentComposerView has 26 functions (exceeds 20 allowed). Consider refactoring.
              Open

              slices.AttachmentComposerView = Backbone.View.extend({
              
                DROP_THRESHOLD: 15,
              
                views: {}, // internal view cache
              Severity: Minor
              Found in app/assets/javascripts/slices/app/views/attachment_composer_view.js - About 3 hrs to fix

                Class Page has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Page
                  include Mongoid::Document
                  include Mongoid::Timestamps
                  include MongoSearch::Searchable
                
                
                Severity: Minor
                Found in app/models/page.rb - About 2 hrs to fix

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

                      '<div class="markdown-cheat-sheet">' +
                        '<h4>Markdown Cheat Sheet</h4>' +
                        '<div class="columns">' +
                          '<div class="column">' +
                            '<code># This is an &lt;h1&gt;</code>' +
                  app/assets/javascripts/slices/app/views/token_field_view.js on lines 33..55

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

                  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

                      '<input type="text" class="input" name="{{id}}" list="datalist-{{id}}">' +
                      '<span class="tokens">' +
                        '{{#each values}}' +
                          '<span class="token" data-value="{{this}}" unselectable="true">{{this}} <span class="del">&times;</span></span>' +
                        '{{/each}}' +
                  Severity: Major
                  Found in app/assets/javascripts/slices/app/views/token_field_view.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/slices/app/helpers/markdown_cheat_sheet.js on lines 9..31

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

                  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

                    renderFields: function() {
                      if (!_.isFunction(this.options.fields)) return;
                  
                      this.$('.attachment-fields').
                      html(this.options.fields(this.model.attributes)).
                  Severity: Major
                  Found in app/assets/javascripts/slices/app/views/attachment_view.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/slices/app/views/composer_item_view.js on lines 27..34

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

                  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

                    renderFields: function() {
                      if (!_.isFunction(this.options.fields)) return;
                  
                      this.$('.item-fields')
                      .html(this.options.fields(this.model.attributes))
                  app/assets/javascripts/slices/app/views/attachment_view.js on lines 51..58

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

                  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

                      this.uploadWithOptions(url, data, {
                        progress: function(xhr, progress) { self.onProgress(progress) },
                        success: function (response) { self.onSuccess(response) },
                        error: function (response) { self.onError(response) }
                      });
                  Severity: Major
                  Found in app/assets/javascripts/slices/app/models/file.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/slices/app/models/s3_file.js on lines 33..37

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language