SpontaneousCMS/spontaneous

View on GitHub

Showing 261 of 342 total issues

Class User has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

  class User < Sequel::Model(:spontaneous_users)
    extend Forwardable

    plugin :timestamps

Severity: Minor
Found in lib/spontaneous/permissions/user.rb - About 4 hrs to fix

    File box_view.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // console.log('Loading BoxView...')
    
    Spontaneous.Views.BoxView = (function($, S) {
        'use strict';
        var dom = S.Dom;
    Severity: Minor
    Found in application/js/views/box_view.js - About 4 hrs to fix

      File schema.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Spontaneous
        module Schema
          autoload :UID, 'spontaneous/schema/uid'
          autoload :UIDMap, 'spontaneous/schema/uid_map'
          autoload :SchemaModification, 'spontaneous/schema/schema_modification'
      Severity: Minor
      Found in lib/spontaneous/schema.rb - About 4 hrs to fix

        Method schema_validate has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

              def schema_validate(schema)
                if schema_id.nil?
                  schema.missing_id!(:type, self)
                else
                  # only need to check internal consistency if class already existed
        Severity: Minor
        Found in lib/spontaneous/model/core/schema_hierarchy.rb - 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 Properties has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Spontaneous.Properties = (function($, S) {
            var Properties = new JS.Module({
                _props_debug: false,
                _props_properties: function() {
                    if (!this._props_property_store) { this._props_property_store = {}; }
        Severity: Major
        Found in application/js/properties.js - About 4 hrs to fix

          Function Popover has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Spontaneous.Popover = (function($, S) {
              var dom = S.Dom;
              var __popover_id = 0;
              var Popover = new JS.Class({
                  initialize: function(view) {
          Severity: Major
          Found in application/js/popover.js - About 3 hrs to fix

            Function Types has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Spontaneous.Types = (function($, S) {
                var ajax = S.Ajax
            , user = S.User
            , type_map = {};
            
            
            Severity: Major
            Found in application/js/types.js - About 3 hrs to fix

              Function Dom has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

              Spontaneous.Dom = (function($, S) {
                  var tags = 'div p iframe a span strong i img select option label ul li dl dt dd table tr td h1 h2 h3 h4 header input button form textarea optgroup'.split(' ');
                  var Dom = {
                      body: function() {
                          return $(document.body);
              Severity: Minor
              Found in application/js/dom.js - About 3 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 ShardedUpload has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

              Spontaneous.ShardedUpload = (function($, S) {
                  var dom = S.Dom;
                  var upload_id = (new Date()).valueOf();
                  var Shard = new JS.Class({
                      initialize: function(uploader, index, blob) {
              Severity: Minor
              Found in application/js/sharded_upload.js - About 3 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 a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

              Spontaneous.Image = (function($, S) {
                  var dom = Spontaneous.Dom;
                  var Image = new JS.Class({
                      initialize: function(field) {
                          this.field = field;
              Severity: Minor
              Found in application/js/image.js - About 3 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

              Class SchemaModification has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class SchemaModification
              
              
                    def initialize(missing_from_map, missing_from_schema, grouped=false)
                      @missing_from_map = missing_from_map
              Severity: Minor
              Found in lib/spontaneous/schema/schema_modification.rb - About 3 hrs to fix

                Function Preview has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Spontaneous.Preview = (function($, S, $window) {
                    var dom = S.Dom, goto_id = 0, Ajax = S.Ajax;
                    var click_param = function() {
                        return '?__click='+(++goto_id);
                    };
                Severity: Major
                Found in application/js/preview.js - About 3 hrs to fix

                  File revision.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Spontaneous::Publishing
                    def self.create_content_table(db, source_table, dest_table_name)
                      # sqlite doesn't like it if you create a table with no columns
                      # so hard-code the id column (but don't make it a pk because the
                      # unique constraint isn't useful at this stage)
                  Severity: Minor
                  Found in lib/spontaneous/publishing/revision.rb - About 3 hrs to fix

                    Function PageBrowser has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Spontaneous.PageBrowser = (function($, S) {
                        var dom = S.Dom
                    , flattenPageList = function(pageList) {
                            var pages = []
                            , comparator = function(a, b) {
                    Severity: Minor
                    Found in application/js/page_browser.js - About 3 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

                    Class PageController has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class PageController < Sinatra::Base
                        class << self
                          # We wrap Sinatra's route methods in order to do two things:
                          #   1. To provide a path of '*' when none is given and
                          #   2. To register the presence of a handler for each method in order to
                    Severity: Minor
                    Found in lib/spontaneous/rack/page_controller.rb - About 3 hrs to fix

                      Class Image has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Image < File
                          autoload :Size, 'spontaneous/field/image/size'
                      
                          include Spontaneous::Media::Image::Renderable
                      
                      
                      Severity: Minor
                      Found in lib/spontaneous/field/image.rb - About 3 hrs to fix

                        Class ScopingMapper has 29 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class ScopingMapper
                              extend Forwardable
                        
                              attr_reader :schema, :table
                        
                        
                        Severity: Minor
                        Found in lib/spontaneous/data_mapper.rb - About 3 hrs to fix

                          Function Upload has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Spontaneous.Upload = (function($, S) {
                              var upload_id = (new Date()).valueOf();
                              var Upload = new JS.Class({
                                  initialize: function(manager, target, file, insert_position) {
                                      this.manager = manager;
                          Severity: Major
                          Found in application/js/upload.js - About 3 hrs to fix

                            Function Box has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                            Spontaneous.Box = (function($, S) {
                                var dom = S.Dom;
                            
                                var Box = new JS.Class(Spontaneous.Content, {
                            
                            
                            Severity: Minor
                            Found in application/js/box.js - About 3 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 preview has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    preview: function() {
                                        Spontaneous.UploadManager.register(this);
                                        var self = this
                            , value = this.currentValue()
                                        , src = value.src
                            Severity: Major
                            Found in application/js/field/image.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language