SpontaneousCMS/spontaneous

View on GitHub

Showing 261 of 342 total issues

Method parse_response has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_response(response)
        case
        when response.is_a?(site.model)
          @page = response
        when response.respond_to?(:to_str)
Severity: Minor
Found in lib/spontaneous/rack/public.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 ContentArea has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

Spontaneous.ContentArea = (function($, S) {
    var dom = S.Dom;
    var ContentArea = new JS.Singleton({
        include: Spontaneous.Properties,

Severity: Minor
Found in application/js/content_area.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

Function add_allowed_types_bar has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        add_allowed_types_bar: function(position, insert_at) {
            var allowed = this.box.allowed_types();
            if (allowed.length === 0) { return ''; }
            var _box = this
, allowed_bar = dom.div('.slot-addable')
Severity: Major
Found in application/js/views/box_view.js - About 2 hrs to fix

    File file.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // console.log('Loading FileField...')
    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 2 hrs to fix

      Function targets_loaded has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              targets_loaded: function(results) {
                  var outer = this._outer, wrap, self = this, targets = self.sort_targets(results.targets);
                  window.setTimeout(function() { self.spinner.stop(); }, 300);
                  if (targets.length === 0) {
                      var $msg = dom.div('.alias-dialogue-empty-targets').text('No targets available...');
      Severity: Major
      Found in application/js/add_alias_dialogue.js - About 2 hrs to fix

        Function FieldPreview has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Spontaneous.FieldPreview = (function($, S) {
            var dom = S.Dom;
        
            var FieldPreview = new JS.Class({
                initialize: function(view, wrap_id, listView) {
        Severity: Major
        Found in application/js/field_preview.js - About 2 hrs to fix

          Method ask_user_details has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                def ask_user_details(defaults = {}, users)
                  attrs = {}
                  level = nil
                  width = 14
                  valid_login = /^[a-z0-9_]{3,}$/
          Severity: Minor
          Found in lib/spontaneous/cli/user.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 panel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  panel: function() {
                      var self = this;
                      if (self._panel) {
                          return self._panel;
                      }
          Severity: Major
          Found in application/js/views/page_view.js - About 2 hrs to fix

            Function body has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    body: function() {
                        var self = this
                            , editing = dom.div('#add-alias-dialogue')
                            , outer = dom.div('.typelist')
                            , paging = dom.div('.paging')
            Severity: Major
            Found in application/js/add_alias_dialogue.js - About 2 hrs to fix

              Function preview has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      preview: function() {
                          Spontaneous.UploadManager.register(this);
                          var self = this
              , value = this.currentValue()
                          , filename = this.currentFilename();
              Severity: Major
              Found in application/js/field/file.js - About 2 hrs to fix

                Function AddHomeDialogue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Spontaneous.AddHomeDialogue = (function($, S, window) {
                    var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
                
                    var AddHomeDialogue = new JS.Class(Dialogue, {
                        initialize: function(types) {
                Severity: Major
                Found in application/js/add_home_dialogue.js - About 2 hrs to fix

                  File modifications.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Spontaneous::Model::Core
                    # Modifications is responsible for tracking changes made to Content items
                    module Modifications
                      extend Spontaneous::Concern
                  
                  
                  Severity: Minor
                  Found in lib/spontaneous/model/core/modifications.rb - About 2 hrs to fix

                    Function panel has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            panel: function() {
                                if (!this._panel) {
                                    var box = this.box;
                                    var panel = dom.div('.slot-content');
                                    panel.addClass('empty');
                    Severity: Minor
                    Found in application/js/views/box_view.js - About 1 hr to fix

                      Function expand_selection has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              expand_selection: function(state) {
                                  state = this.fix_selection_whitespace(state);
                                  var selected = state.selection, m, start = state.start, end = state.end,
                                      _pre_ = this.pre.replace(/\*/g, '\\*'), _post_ = this.post.replace(/\*/g, '\\*');
                      
                      
                      Severity: Minor
                      Found in application/js/field/markdown.js - About 1 hr to fix

                        Method targets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def targets(owner = nil, box = nil, options = {})
                                targets = []
                                classes = []
                                proc_args = [owner, box].compact
                                @alias_classes.each do |source|
                        Severity: Minor
                        Found in lib/spontaneous/model/core/aliases.rb - About 1 hr 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 load_classes_with_requirements has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def load_classes_with_requirements(klasses)
                              klasses.uniq!
                        
                              while klasses.size > 0
                                # Note size to make sure things are loading
                        Severity: Minor
                        Found in lib/spontaneous/loader.rb - About 1 hr 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 targets has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def targets(owner = nil, box = nil, options = {})
                                targets = []
                                classes = []
                                proc_args = [owner, box].compact
                                @alias_classes.each do |source|
                        Severity: Minor
                        Found in lib/spontaneous/model/core/aliases.rb - About 1 hr to fix

                          Function createPanel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  createPanel: function() {
                                      var w = dom.div('.change-set')
                                      , inner = dom.div('.inner')
                                      , page_list = dom.div('.pages')
                                      , add = dom.div('.add').append(dom.span().text(''))
                          Severity: Minor
                          Found in application/js/publish.js - About 1 hr to fix

                            Function Popover has a Cognitive Complexity of 14 (exceeds 5 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: Minor
                            Found in application/js/popover.js - About 1 hr 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 Upload has a Cognitive Complexity of 14 (exceeds 5 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: Minor
                            Found in application/js/upload.js - About 1 hr 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