SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

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

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

                      input.bind('keydown.uideditor', function(event) {
                          var s_key = 83, esc_key = 27;
                          if ((event.ctrlKey || event.metaKey) && event.keyCode === s_key) {
                              submit();
                              return false;
      Severity: Major
      Found in application/js/views/page_view.js and 1 other location - About 2 hrs to fix
      application/js/views/page_view.js on lines 310..316

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

      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

                      input.bind('keydown.urleditor', function(event) {
                          var s_key = 83, esc_key = 27;
                          if ((event.ctrlKey || event.metaKey) && event.keyCode === s_key) {
                              submit();
                              return false;
      Severity: Major
      Found in application/js/views/page_view.js and 1 other location - About 2 hrs to fix
      application/js/views/page_view.js on lines 230..236

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

      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

      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

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

                          onprogress: function(event) {
                              var progress = event.position;
                              this.progress = progress;
                              this.time = (new Date()).valueOf() - this.started;
                              this.uploader.upload_progress(this);
                  Severity: Major
                  Found in application/js/sharded_upload.js and 1 other location - About 1 hr to fix
                  application/js/upload.js on lines 63..68

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

                  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

                          onprogress: function(event) {
                              var position = event.position;
                              this._position = position;
                              this.time = (new Date()).valueOf() - this.started;
                              this.manager.upload_progress(this);
                  Severity: Major
                  Found in application/js/upload.js and 1 other location - About 1 hr to fix
                  application/js/sharded_upload.js on lines 84..89

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

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