SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

Function Location has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Spontaneous.Location = (function($, S) {
    var ajax = S.Ajax;

    var State = new JS.Class({
        initialize: function(path) {
Severity: Major
Found in application/js/location.js - About 6 hrs to fix

    Class Schema has 45 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Schema
          attr_accessor :schema_loader_class
          attr_reader   :uids
          attr_reader   :site
    
    
    Severity: Minor
    Found in lib/spontaneous/schema.rb - About 6 hrs to fix

      Class Format has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Format
          module ClassMethods
            # class_attribute :template_engine
      
            def inherited(subclass)
      Severity: Minor
      Found in lib/spontaneous/output/format.rb - About 6 hrs to fix

        Function Ajax has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Spontaneous.Ajax = (function($, S) {
            'use strict';
        
            $.ajaxSetup({
                'async': true,
        Severity: Major
        Found in application/js/ajax.js - About 6 hrs to fix

          File page_view.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // console.log('Loading Page...')
          
          Spontaneous.Views.PageView = (function($, S, document) {
              var dom = S.Dom, user = S.User, ajax = S.Ajax, Types = S.Types;
          
          
          Severity: Minor
          Found in application/js/views/page_view.js - About 5 hrs to fix

            File publish.js has 410 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // console.log('Loading Publishing...')
            
            Spontaneous.Publishing = (function($, S) {
                var dom = S.Dom, Dialogue = Spontaneous.Dialogue, User = S.User;
            
            
            Severity: Minor
            Found in application/js/publish.js - About 5 hrs to fix

              Class Dataset has 43 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Dataset
                    include Enumerable
              
                    def initialize(dataset, schema, identity_map)
                      @dataset, @schema, @identity_map = dataset, schema, identity_map
              Severity: Minor
              Found in lib/spontaneous/data_mapper/dataset.rb - About 5 hrs to fix

                Class Revision has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Revision
                    class InvalidRevision < Spontaneous::Error; end
                
                    class Generator
                      attr_reader :modified_pages
                Severity: Minor
                Found in lib/spontaneous/publishing/revision.rb - About 5 hrs to fix

                  Function PieceView has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Spontaneous.Views.PieceView = (function($, S) {
                      var dom = S.Dom, user = S.User;
                      var debug = 0;
                  
                      var ConfirmDeletePopup = new JS.Class(Spontaneous.PopoverView, {
                  Severity: Minor
                  Found in application/js/views/piece_view.js - About 5 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 a Cognitive Complexity of 38 (exceeds 5 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: Minor
                  Found in application/js/properties.js - About 5 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 Views has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Spontaneous.Views = (function($, S) {
                      var dom = S.Dom;
                      var View = new JS.Class({
                          include: Spontaneous.Properties,
                          initialize: function(content) {
                  Severity: Major
                  Found in application/js/views.js - About 5 hrs to fix

                    Function PageBrowser has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Spontaneous.PageBrowser = (function($, S) {
                        var dom = S.Dom
                    , flattenPageList = function(pageList) {
                            var pages = []
                            , comparator = function(a, b) {
                    Severity: Major
                    Found in application/js/page_browser.js - About 5 hrs to fix

                      Function File has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Spontaneous.Field.File = (function($, S) {
                          var dom = S.Dom;
                          var FileField = new JS.Class(Spontaneous.Field.String, {
                              selected_files: false,
                      
                      
                      Severity: Minor
                      Found in application/js/field/file.js - About 5 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

                              fit_dimensions_inverse: function(width, height) {
                                  var ratio = 1.0;
                                  if (this.is_portrait()) {
                                      if (this.width() > width) {
                                          ratio = width/this.width();
                      Severity: Major
                      Found in application/js/image.js and 1 other location - About 5 hrs to fix
                      application/js/image.js on lines 16..28

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

                      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

                              fit_dimensions: function(width, height) {
                                  var ratio = 1.0;
                                  if (this.is_landscape()) {
                                      if (this.width() > width) {
                                          ratio = width/this.width();
                      Severity: Major
                      Found in application/js/image.js and 1 other location - About 5 hrs to fix
                      application/js/image.js on lines 29..41

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

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

                      Spontaneous.Location = (function($, S) {
                          var ajax = S.Ajax;
                      
                          var State = new JS.Class({
                              initialize: function(path) {
                      Severity: Minor
                      Found in application/js/location.js - About 5 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 Box has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Spontaneous.Box = (function($, S) {
                          var dom = S.Dom;
                      
                          var Box = new JS.Class(Spontaneous.Content, {
                      
                      
                      Severity: Major
                      Found in application/js/box.js - About 5 hrs to fix

                        Function Ajax has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        Spontaneous.Ajax = (function($, S) {
                            'use strict';
                        
                            $.ajaxSetup({
                                'async': true,
                        Severity: Minor
                        Found in application/js/ajax.js - About 5 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 sync_to_revision has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sync_to_revision(revision, origin=false)
                              # 'publish' is a lock to make sure the duplication doesn't cross
                              # page boundaries unless that's necessary (such as in the case
                              # of a page addition)
                              publish = origin || !page?
                        Severity: Minor
                        Found in lib/spontaneous/model/core/publishing.rb - About 5 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

                        File box.rb has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Spontaneous
                          class Box
                            include Enumerable
                        
                            include Spontaneous::Model::Core::SchemaHierarchy
                        Severity: Minor
                        Found in lib/spontaneous/box.rb - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language