SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

File base.rb has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Spontaneous
  module Field
    class Base
      module ClassMethods
        def has_editor(js_class = ui_class)
Severity: Minor
Found in lib/spontaneous/field/base.rb - About 4 hrs to fix

    Class Fog has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Fog < Backend
        def initialize(config)
          @config = config
        end
    
    
    Severity: Minor
    Found in lib/spontaneous/output/store/fog.rb - About 4 hrs to fix

      Function ContentArea has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

                edit: function() {
                    var wrap = dom.div(),
                    drop_wrap = dom.div({'style':'position:relative;'}),
                        value = this.currentEditValue(),
                        src = value.src,
        Severity: Major
        Found in application/js/field/image.js - About 4 hrs to fix

          File image.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // console.log('Loading ImageField...')
          Spontaneous.Field.Image = (function($, S) {
              'use strict';
              var dom = S.Dom;
              var ImageFieldConflictView = new JS.Class(S.Field.String.ConflictView, {
          Severity: Minor
          Found in application/js/field/image.js - About 4 hrs to fix

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

              class BoxPrototype
            
                attr_reader :name, :options, :owner
            
                def initialize(owner, name, options, blocks = [], &block)
            Severity: Minor
            Found in lib/spontaneous/prototypes/box_prototype.rb - About 4 hrs to fix

              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

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

                                  if (_window.createBlobURL) {
                                      _window.URL[createObjectURL] = function(file) {
                                          return _window.createBlobURL(file);
                                      };
                                  } else if (_window[createObjectURL]) {
                  Severity: Major
                  Found in application/js/compatibility.js and 1 other location - About 4 hrs to fix
                  application/js/compatibility.js on lines 97..113

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

                  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

                                  if (_window.revokeBlobURL) {
                                      _window.URL[revokeObjectURL] = function(file) {
                                          return _window.revokeBlobURL(file);
                                      };
                                  } else if (_window[revokeObjectURL]) {
                  Severity: Major
                  Found in application/js/compatibility.js and 1 other location - About 4 hrs to fix
                  application/js/compatibility.js on lines 80..96

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

                  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

                  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

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

                              currentEditValue: function() {
                                  var value, pending, ui, v = this.get('value');
                                  if ((pending = v.__pending__)) {
                                      return pending.value;
                                  }
                      Severity: Major
                      Found in application/js/field/image.js and 1 other location - About 4 hrs to fix
                      application/js/field/file.js on lines 27..38

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

                      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

                              currentEditValue: function() {
                                  var value, pending, ui, v = this.get('value');
                                  if ((pending = v.__pending__)) {
                                      return pending.value;
                                  }
                      Severity: Major
                      Found in application/js/field/file.js and 1 other location - About 4 hrs to fix
                      application/js/field/image.js on lines 70..81

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

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

                          Severity
                          Category
                          Status
                          Source
                          Language