SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

File top_bar.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// console.log("Loading TopBar...")

Spontaneous.TopBar = (function($, S) {
    var dom = S.Dom, Ajax = S.Ajax;

Severity: Major
Found in application/js/top_bar.js - About 1 day to fix

    Function File has 258 lines of code (exceeds 25 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: Major
    Found in application/js/field/file.js - About 1 day to fix

      Function EditPanel has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
      Open

      Spontaneous.EditPanel = (function($, S) {
          var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
      
          var EditPanel = new JS.Class(Dialogue, {
              initialize: function(parent_view) {
      Severity: Minor
      Found in application/js/edit_panel.js - About 1 day 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 PageView has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

      Spontaneous.Views.PageView = (function($, S, document) {
          var dom = S.Dom, user = S.User, ajax = S.Ajax, Types = S.Types;
      
          var FunctionBar = function(page) {
              this.page = page;
      Severity: Minor
      Found in application/js/views/page_view.js - About 1 day 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 EditPanel has 238 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Spontaneous.EditPanel = (function($, S) {
          var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
      
          var EditPanel = new JS.Class(Dialogue, {
              initialize: function(parent_view) {
      Severity: Major
      Found in application/js/edit_panel.js - About 1 day to fix

        Function AddAliasDialogue has 232 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Spontaneous.AddAliasDialogue = (function($, S, window) {
            'use strict';
            var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
        
            var Target = function(data, element) {
        Severity: Major
        Found in application/js/add_alias_dialogue.js - About 1 day to fix

          Function UploadManager has 230 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Spontaneous.UploadManager = (function($, S) {
              var dom = S.Dom;
              var Upload = S.Upload;
              var WrapUpload = new JS.Class(Upload, {
                  start: function() {
          Severity: Major
          Found in application/js/upload_manager.js - About 1 day to fix

            Function Content has 230 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Spontaneous.Content = (function($, S) {
                'use strict';
                var dom = S.Dom;
            
                var Content = new JS.Class({
            Severity: Major
            Found in application/js/content.js - About 1 day to fix

              Function Image has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
              Open

              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 1 day 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 UploadManager has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
              Open

              Spontaneous.UploadManager = (function($, S) {
                  var dom = S.Dom;
                  var Upload = S.Upload;
                  var WrapUpload = new JS.Class(Upload, {
                      start: function() {
              Severity: Minor
              Found in application/js/upload_manager.js - About 1 day 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 user_admin.js has 509 lines of code (exceeds 250 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: Major
              Found in application/js/meta_view/user_admin.js - About 1 day to fix

                Function PieceView has 198 lines of code (exceeds 25 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: Major
                Found in application/js/views/piece_view.js - About 7 hrs to fix

                  Function Content has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Spontaneous.Content = (function($, S) {
                      'use strict';
                      var dom = S.Dom;
                  
                      var Content = new JS.Class({
                  Severity: Minor
                  Found in application/js/content.js - About 7 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 Dialogue has 193 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Spontaneous.Dialogue = (function($, S) {
                      var dom = S.Dom;
                  
                  
                      var Button = new JS.Class({
                  Severity: Major
                  Found in application/js/dialogue.js - About 7 hrs to fix

                    Function String has 193 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Spontaneous.Field.String = (function($, S) {
                        var dom = S.Dom;
                        var StringFieldConflictView = new JS.Class({
                            initialize: function(dialogue, conflict) {
                                this.dialogue = dialogue;
                    Severity: Major
                    Found in application/js/field/string.js - About 7 hrs to fix

                      Function ShardedUpload has 190 lines of code (exceeds 25 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: Major
                      Found in application/js/sharded_upload.js - About 7 hrs to fix

                        Function AddAliasDialogue has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                        Open

                        Spontaneous.AddAliasDialogue = (function($, S, window) {
                            'use strict';
                            var dom = S.Dom, Dialogue = Spontaneous.Dialogue;
                        
                            var Target = function(data, element) {
                        Severity: Minor
                        Found in application/js/add_alias_dialogue.js - About 7 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

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

                                aliasTargetLink: function() {
                                    var self = this;
                                    if (!self.isAlias()) {
                                        return '';
                                    }
                        Severity: Major
                        Found in application/js/views/page_view.js and 1 other location - About 7 hrs to fix
                        application/js/views/page_view.js on lines 83..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 179.

                        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

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

                                aliasTargetLink: function() {
                                    var self = this;
                                    if (!self.isAlias()) {
                                        return '';
                                    }
                        Severity: Major
                        Found in application/js/views/page_view.js and 1 other location - About 7 hrs to fix
                        application/js/views/page_view.js on lines 134..147

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

                        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 Scope has 51 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class Scope
                        
                              def initialize(dataset, schema)
                                @dataset      = dataset
                                @schema       = schema
                        Severity: Major
                        Found in lib/spontaneous/data_mapper/scope.rb - About 7 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language