withassociates/slices

View on GitHub

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

            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

            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

                  Function addSliceTemplate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function addSliceTemplate(slice) {
                        var templateData = {},
                            sliceBlock,
                            sliceContent,
                            sliceContentTemplate = slices.availableSlices[slice.type].template,
                  Severity: Major
                  Found in app/assets/javascripts/slices/app/slices.js - About 2 hrs to fix

                    Class Asset has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

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

                      Function onFormSubmitted has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function onFormSubmitted(event) {
                            event.preventDefault();
                      
                            busy = true;
                      
                      
                      Severity: Major
                      Found in app/assets/javascripts/slices/app/slices.js - About 2 hrs to fix

                        Function thumbPress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          thumbPress: function(event, thumb) {
                            _.invoke(this.selection, 'deselect');
                        
                            if (event.shiftKey) {
                              if (this.selection.length === 0) {
                        Severity: Minor
                        Found in app/assets/javascripts/slices/app/views/asset_library_view.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 save has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function save() {
                              var dfd = $.Deferred();
                        
                              var params = $.extend({}, pageData);
                        
                        
                        Severity: Minor
                        Found in app/assets/javascripts/slices/app/models/page.js - About 1 hr to fix

                          Method update_attributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def update_attributes(attributes)
                              attributes = attributes.symbolize_keys
                          
                              unless home?
                                if attributes.has_key?(:name) || attributes.has_key?(:permalink)
                          Severity: Minor
                          Found in app/models/page.rb - 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 countMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            countMessage: function() {
                              var t = this.countMessages,
                                  total = this.collection.totalEntries,
                                  count = this.collection.length;
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/slices/app/views/asset_library_view.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 body has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            body: function() {
                              var data        = [],
                                  today       = moment().startOf('day'),
                                  thisMonth   = this.month.clone(),
                                  nextMonth   = thisMonth.clone().add('months', 1),
                          Severity: Minor
                          Found in app/assets/javascripts/slices/app/views/calendar_view.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 thumbPress has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            thumbPress: function(event, thumb) {
                              _.invoke(this.selection, 'deselect');
                          
                              if (event.shiftKey) {
                                if (this.selection.length === 0) {
                          Severity: Minor
                          Found in app/assets/javascripts/slices/app/views/asset_library_view.js - About 1 hr to fix

                            Function editinplace has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              $.fn.editinplace = function (settings) {
                                this.find('textarea,input[type=text]').each(
                                function () {
                                  var ta = $(this);
                                  var val = ta.val();
                            Severity: Minor
                            Found in app/assets/javascripts/slices/lib/plugins.js - About 1 hr to fix

                              Function addSliceContainers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function addSliceContainers() {
                                    _.each(slices.availableContainers, function (container, machineName) {
                                      $('#container-' + machineName + ' ul').empty();
                                    });
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/slices/app/slices.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language