SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

Function Markdown has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
Open

Spontaneous.Field.Markdown = (function($, S) {
    var dom = S.Dom;
    var TextCommand = new JS.Class({
        name: '',
        pre: '',
Severity: Minor
Found in application/js/field/markdown.js - About 3 days 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 Markdown has 646 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Spontaneous.Field.Markdown = (function($, S) {
    var dom = S.Dom;
    var TextCommand = new JS.Class({
        name: '',
        pre: '',
Severity: Major
Found in application/js/field/markdown.js - About 3 days to fix

    Function TopBar has 606 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Spontaneous.TopBar = (function($, S) {
        var dom = S.Dom, Ajax = S.Ajax;
    
        var disableParent = function(el) {
            el.hover(function() {
    Severity: Major
    Found in application/js/top_bar.js - About 3 days to fix

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

              pageAliasesPanel: function() {
                  var $wrap = dom.div('.page-aliases');
                  var aliases = this.page.content.aliases;
                  if (aliases.length === 0) {
                      return $wrap;
      Severity: Major
      Found in application/js/views/page_view.js and 1 other location - About 2 days to fix
      application/js/views/page_view.js on lines 97..133

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

      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

              pageAliasesPanel: function() {
                  var $wrap = dom.div('.page-aliases');
                  var aliases = this.page.content.aliases;
                  if (aliases.length === 0) {
                      return $wrap;
      Severity: Major
      Found in application/js/views/page_view.js and 1 other location - About 2 days to fix
      application/js/views/page_view.js on lines 148..184

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

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

      Spontaneous.TopBar = (function($, S) {
          var dom = S.Dom, Ajax = S.Ajax;
      
          var disableParent = function(el) {
              el.hover(function() {
      Severity: Minor
      Found in application/js/top_bar.js - About 2 days 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 507 lines of code (exceeds 25 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 2 days to fix

        Function PageView has 413 lines of code (exceeds 25 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: Major
        Found in application/js/views/page_view.js - About 2 days to fix

          Function Publishing has 408 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Spontaneous.Publishing = (function($, S) {
              var dom = S.Dom, Dialogue = Spontaneous.Dialogue, User = S.User;
          
              var PublishingDialogue = new JS.Class(Dialogue, {
                  initialize: function(content) {
          Severity: Major
          Found in application/js/publish.js - About 2 days to fix

            Method smarten has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
            Open

                def smarten(string, options=[2])
                  do_quotes = do_backticks = do_dashes = do_ellipses = do_stupify = nil
                  convert_quotes = false
            
                  if options.include? 0
            Severity: Minor
            Found in lib/spontaneous/utils/smart_quotes.rb - 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 Image has 350 lines of code (exceeds 25 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: Major
            Found in application/js/field/image.js - About 1 day to fix

              Class Box has 91 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Box
                  include Enumerable
              
                  include Spontaneous::Model::Core::SchemaHierarchy
                  include Spontaneous::Model::Core::Fields
              Severity: Major
              Found in lib/spontaneous/box.rb - About 1 day to fix

                Function BoxView has 344 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function BoxView has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Spontaneous.Views.BoxView = (function($, S) {
                      'use strict';
                      var dom = S.Dom;
                  
                      var BoxView = new JS.Class(Spontaneous.Views.View, {
                  Severity: Minor
                  Found in application/js/views/box_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 Publishing has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Spontaneous.Publishing = (function($, S) {
                      var dom = S.Dom, Dialogue = Spontaneous.Dialogue, User = S.User;
                  
                      var PublishingDialogue = new JS.Class(Dialogue, {
                          initialize: function(content) {
                  Severity: Minor
                  Found in application/js/publish.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

                  Class Base has 82 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Base
                        module ClassMethods
                          def has_editor(js_class = ui_class)
                            define_singleton_method(:editor_class) { js_class }
                          end
                  Severity: Major
                  Found in lib/spontaneous/field/base.rb - About 1 day to fix

                    Function Progress has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Spontaneous.Progress = (function($, S) {
                        var Progress = function(parent, size, options) {
                            var defaults = {
                                spinner_fg_color: '#000000', // colour
                                spinner_bg_color: null, // null  or false for transparent
                    Severity: Minor
                    Found in application/js/progress.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 Progress has 290 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Spontaneous.Progress = (function($, S) {
                        var Progress = function(parent, size, options) {
                            var defaults = {
                                spinner_fg_color: '#000000', // colour
                                spinner_bg_color: null, // null  or false for transparent
                    Severity: Major
                    Found in application/js/progress.js - About 1 day to fix

                      File markdown.js has 648 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // console.log('Loading DiscountField...')
                      
                      Spontaneous.Field.Markdown = (function($, S) {
                          var dom = S.Dom;
                          var TextCommand = new JS.Class({
                      Severity: Major
                      Found in application/js/field/markdown.js - About 1 day to fix

                        Function Progress has 287 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var Progress = function(parent, size, options) {
                                var defaults = {
                                    spinner_fg_color: '#000000', // colour
                                    spinner_bg_color: null, // null  or false for transparent
                                    progress_fg_color: '#000000', // colour
                        Severity: Major
                        Found in application/js/progress.js - About 1 day to fix
                          Severity
                          Category
                          Status
                          Source
                          Language