SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

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

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

                        edited.append(dom.img().attr('src', this.values.local_edited)).click(function() {
                            this.useValue(this.values.local_edited);
                            edited.add(original).removeClass('selected');
                            edited.addClass('selected');
                        }.bind(this));
            Severity: Major
            Found in application/js/field/image.js and 1 other location - About 3 hrs to fix
            application/js/field/image.js on lines 15..19

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

            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

            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

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

                          original.append(dom.img().attr('src', this.values.server_original)).click(function() {
                              this.useValue(this.values.server_original);
                              edited.add(original).removeClass('selected');
                              original.addClass('selected');
                          }.bind(this));
              Severity: Major
              Found in application/js/field/image.js and 1 other location - About 3 hrs to fix
              application/js/field/image.js on lines 21..25

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

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

                  Class Index has 28 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Index
                  
                      attr_reader :name, :search_types, :site
                  
                      def initialize(site, name, &definition)
                  Severity: Minor
                  Found in lib/spontaneous/search/index.rb - About 3 hrs to fix

                    Class FieldPrototype has 28 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class FieldPrototype
                        attr_reader :owner, :name, :options
                    
                        def initialize(owner, name, type, options={}, blocks = [], &block)
                          @owner = owner
                    Severity: Minor
                    Found in lib/spontaneous/prototypes/field_prototype.rb - About 3 hrs to fix

                      Function Dialogue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Spontaneous.Dialogue = (function($, S) {
                          var dom = S.Dom;
                      
                      
                          var Button = new JS.Class({
                      Severity: Minor
                      Found in application/js/dialogue.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 UserAdmin has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Spontaneous.MetaView.UserAdmin = (function($, S){
                          var dom = S.Dom, ajax = S.Ajax;
                      
                          var Level = new JS.Class({
                              initialize: function(attributes) {
                      Severity: Minor
                      Found in application/js/meta_view/user_admin.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 ConflictedFieldDialogue has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Spontaneous.ConflictedFieldDialogue = (function($, S) {
                          var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
                      
                          var ConflictedFieldDialogue = new JS.Class(Dialogue, {
                              initialize: function(parent_view, conflicted_fields) {
                      Severity: Major
                      Found in application/js/conflicted_field_dialogue.js - About 3 hrs to fix

                        File content_model.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'spontaneous/data_mapper/content_model/column_accessors'
                        require 'spontaneous/data_mapper/content_model/serialization'
                        require 'spontaneous/data_mapper/content_model/timestamps'
                        require 'spontaneous/data_mapper/content_model/instance_hooks'
                        require 'spontaneous/data_mapper/content_model/associations'
                        Severity: Minor
                        Found in lib/spontaneous/data_mapper/content_model.rb - About 3 hrs to fix

                          Class BoxContents has 27 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class BoxContents < Spontaneous::Output::RenderableArray
                          
                                attr_reader :box, :schema_id
                          
                                def initialize(box)
                          Severity: Minor
                          Found in lib/spontaneous/collections/box_contents.rb - About 3 hrs to fix

                            Function BoxContainer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                            Spontaneous.BoxContainer = (function($, S) {
                                var dom = S.Dom;
                            
                                var BoxContainer = new JS.Class(S.Views.View, {
                            
                            
                            Severity: Minor
                            Found in application/js/box_container.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