adamrenklint/asimov-static

View on GitHub

Showing 59 of 136 total issues

Function set has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

  set: function(models, options) {
    options = _.defaults(options || {}, setOptions);
    // options = _.merge({}, this.options, options);
    if (options.parse) models = this.parse(models, options);
    if (!_.isArray(models)) models = models ? [models] : [];
Severity: Minor
Found in lib/core/Collection.js - About 6 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 set has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  set: function(key, val, options) {
    var attr, attrs, unset, changes, silent, changing, prev, current;
    if (key == null) return this;

    // Handle both `"key", value` and `{key: value}` -style arguments.
Severity: Minor
Found in lib/core/Model.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

Collection has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

var Collection = Base.extend({

  'model': Model,

  'initialize': function (models, options) {
Severity: Minor
Found in lib/core/Collection.js - About 3 hrs to fix

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

      save: function(key, val, options) {
        var attrs, method, xhr, attributes = this.attributes;
    
        // Handle both `"key", value` and `{key: value}` -style arguments.
        if (key == null || typeof key === 'object') {
    Severity: Minor
    Found in lib/core/Model.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 renderValues has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      'renderValues': function (model) {
    
        var self = this;
        var options = self.options;
        var templates = options.templates;
    Severity: Minor
    Found in lib/nodes/PageNodesCollection.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

    File Collection.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var Base = require('./Base');
    var Model = require('./Model');
    var _ = require('lodash');
    
    var _super = Base.prototype;
    Severity: Minor
    Found in lib/core/Collection.js - About 2 hrs to fix

      Model has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      var Model = Base.extend({
      
        'initialize': function (attributes, options) {
      
          var self = this;
      Severity: Minor
      Found in lib/core/Model.js - About 2 hrs to fix

        Function set has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          set: function(key, val, options) {
            var attr, attrs, unset, changes, silent, changing, prev, current;
            if (key == null) return this;
        
            // Handle both `"key", value` and `{key: value}` -style arguments.
        Severity: Minor
        Found in lib/core/Model.js - About 1 hr to fix

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

            set: function(models, options) {
              options = _.defaults(options || {}, setOptions);
              // options = _.merge({}, this.options, options);
              if (options.parse) models = this.parse(models, options);
              if (!_.isArray(models)) models = models ? [models] : [];
          Severity: Minor
          Found in lib/core/Collection.js - About 1 hr to fix

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

              'renderValues': function (model) {
            
                var self = this;
                var options = self.options;
                var templates = options.templates;
            Severity: Minor
            Found in lib/nodes/PageNodesCollection.js - About 1 hr to fix

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

                'render': function () {
              
                  var self = this;
                  var started = new Date();
              
              
              Severity: Minor
              Found in lib/render/Queue.js - About 1 hr to fix

                Function run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  'run': function (model) {
                
                    var self = this;
                    var deferred = self.deferred();
                
                
                Severity: Minor
                Found in lib/render/StyleSheetRenderJob.js - About 1 hr to fix

                  Function run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    'run': function (src, params) {
                  
                      var self = this;
                  
                      if (typeof src !== 'string') {
                  Severity: Minor
                  Found in lib/helpers/image.js - About 1 hr to fix

                    Function run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      'run': function (model) {
                    
                        var self = this;
                        var deferred = self.deferred();
                    
                    
                    Severity: Minor
                    Found in lib/render/ScriptRenderJob.js - About 1 hr to fix

                      Function getNextBatch has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        'getNextBatch': function () {
                      
                          var self = this;
                          var limit = self.limit;
                          var models = [];
                      Severity: Minor
                      Found in lib/render/Queue.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 filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        'filter': function (test, options) {
                      
                          var self = this;
                          options || (options = {});
                      
                      
                      Severity: Minor
                      Found in lib/nodes/PageNodesCollection.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        'run': function (href, innerText, params, block) {
                      
                          var self = this;
                      
                          if (typeof href !== 'string') {
                      Severity: Minor
                      Found in lib/helpers/link.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 start has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        'start': function () {
                      
                          var self = this;
                          var app = self.app = express();
                      
                      
                      Severity: Minor
                      Found in lib/server/Server.js - About 1 hr to fix

                        Function plugin has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function plugin () {
                        
                          asimov
                            .config('defaultLangCode', 'en')
                            .config('defaultLangFallback', true)
                        Severity: Minor
                        Found in index.js - About 1 hr to fix

                          Function destroy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            destroy: function(options) {
                              options = options ? _.clone(options) : {};
                              var model = this;
                              var success = options.success;
                          
                          
                          Severity: Minor
                          Found in lib/core/Model.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