SpontaneousCMS/spontaneous

View on GitHub

Showing 261 of 342 total issues

Function complete has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            this.panel.velocity({'height': '+=14'}, {duration: 200, complete: function() {
                var view = $('h3', this.panel), edit = $('.edit', this.panel), spacer = $('.path-spacer', this.panel);
                spacer.add(view).hide();
                edit.hide().empty();
                var path = [''], parts = this.page.get('path').split('/'), slug = parts.pop();
Severity: Major
Found in application/js/views/page_view.js - About 2 hrs to fix

    Method run! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.run!(site, options={})
          host = options["host"] || Spontaneous::Site.config.host || "0.0.0.0"
          port = options["port"] || Spontaneous::Site.config.port || 2012
          adapter = options["adapter"] || Spontaneous::Site.config.adapter
    
    
    Severity: Minor
    Found in lib/spontaneous/server.rb - 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 Image has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Spontaneous.Image = (function($, S) {
        var dom = Spontaneous.Dom;
        var Image = new JS.Class({
            initialize: function(field) {
                this.field = field;
    Severity: Major
    Found in application/js/image.js - About 2 hrs to fix

      Function edit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              edit: function() {
                  var self = this;
                  var wrap = dom.div('.file-field', {'style':'position:relative;'});
                  var value = this.value();
                  var input = this.input();
      Severity: Major
      Found in application/js/field/file.js - About 2 hrs to fix

        Class Site has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Site < ::Thor
              include Spontaneous::Cli::TaskUtils
              include ::Simultaneous::Task
              namespace :site
        
        
        Severity: Minor
        Found in lib/spontaneous/cli/site.rb - About 2 hrs to fix

          Class PrototypeSet has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class PrototypeSet
              include Enumerable
          
              attr_reader :store, :local_order
          
          
          Severity: Minor
          Found in lib/spontaneous/collections/prototype_set.rb - About 2 hrs to fix

            Class Site has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Spontaneous::Site
              module Publishing
                extend Spontaneous::Concern
            
                def background_mode
            Severity: Minor
            Found in lib/spontaneous/site/publishing.rb - About 2 hrs to fix

              Function Editing has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Spontaneous.Editing = (function($, S) {
                  var dom = S.Dom, Page = S.Page;
              
                  var Editing = new JS.Singleton({
                      include: Spontaneous.Properties,
              Severity: Major
              Found in application/js/editing.js - About 2 hrs to fix

                Function State has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Spontaneous.State = (function($, S) {
                    var ajax = S.Ajax;
                
                    var ContentState = new JS.Class({
                        initialize: function(content) {
                Severity: Major
                Found in application/js/state.js - About 2 hrs to fix

                  Function Types has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Spontaneous.Types = (function($, S) {
                      var ajax = S.Ajax
                  , user = S.User
                  , type_map = {};
                  
                  
                  Severity: Minor
                  Found in application/js/types.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

                  Method at_depth has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def at_depth(depth, opts = {})
                        return root_at_depth(depth) if is_public_root? || is_private_root?
                        parent_depth = [0, depth - 1].max
                        parent = if (parent_depth == 0)
                          public_root
                  Severity: Minor
                  Found in lib/spontaneous/model/page/page_tree.rb - 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

                  Method to_html has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def to_html(opts={})
                        default_attr = { src: src, alt: "" }
                        attrs = Spontaneous::Field::Image.default_attributes.merge(opts)
                  
                        if template_params && template_params.length > 0 && template_params[0].is_a?(Hash)
                  Severity: Minor
                  Found in lib/spontaneous/media/image/renderable.rb - 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

                  Method safe_load has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def safe_load(file, mtime=nil)
                          reload = mtime && mtime > mtimes[file]
                  
                          logger.debug "Reloading #{relativize_path(file)}" if reload
                  
                  
                  Severity: Minor
                  Found in lib/spontaneous/loader.rb - 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 expand_selection has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          expand_selection: function(state) {
                              var selected = (state.selection || ''), m, s, l, start = state.start, end = state.end, br = /\r?\n/, below = false;
                              // detect & deal with the cursor being on the line below
                              // (the one with the -'s or ='s)
                              // TODO: deal with the case where the cursor is at the start of the =- line
                  Severity: Major
                  Found in application/js/field/markdown.js - About 2 hrs to fix

                    Class Style has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Style
                        attr_reader :owner, :prototype
                    
                        def initialize(owner, prototype = nil)
                          @owner, @prototype = owner, prototype
                    Severity: Minor
                    Found in lib/spontaneous/style.rb - About 2 hrs to fix

                      Class Generator has 22 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Generator
                            attr_reader :modified_pages
                      
                            # Both revision & source_revision should be instances of Revision
                            def initialize(revision)
                      Severity: Minor
                      Found in lib/spontaneous/publishing/revision.rb - About 2 hrs to fix

                        Class AllowedType has 22 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class AllowedType
                              prepend Spontaneous::Model::Page::Singleton::AllowedTypeMethods
                        
                              attr_accessor :allow_subclasses
                        
                        
                        Severity: Minor
                        Found in lib/spontaneous/model/box/allowed_types.rb - About 2 hrs to fix

                          Function Select has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Spontaneous.Field.Select = (function($, S) {
                              'use strict';
                          
                              var dom = S.Dom
                          , ajax = S.Ajax;
                          Severity: Major
                          Found in application/js/field/select.js - About 2 hrs to fix

                            File loader.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'pathname'
                            
                            module Spontaneous
                              class Loader
                                attr_reader :use_reloader, :load_paths
                            Severity: Minor
                            Found in lib/spontaneous/loader.rb - About 2 hrs to fix

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

                              Spontaneous.PopoverView = (function($, S) {
                                  var dom = S.Dom;
                                  var PopoverView = new JS.Class({
                                      initialize: function() {
                                          // should be over-ridden by subclasses
                              Severity: Major
                              Found in application/js/popover_view.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language