yoctore/yocto-render

View on GitHub

Showing 14 of 29 total issues

Function buildAssetKeyValue has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

Render.prototype.buildAssetKeyValue = function (reference, destination,
  keyLabel, valueLabel, stype) {
  // Structure is correct
  if (_.has(reference, stype) && _.isArray(reference[stype]) && !_.isEmpty(reference[stype])) {
    // Parse all reference
Severity: Minor
Found in src/index.js - About 5 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 updateConfig has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Render.prototype.updateConfig = function (value) {
  // Define meta rules
  var metaHttpEquivRules = joi.object().keys({
    name  : joi.string().required().not(null),
    value : joi.string().required().not(null)
Severity: Major
Found in src/index.js - About 4 hrs to fix

    File index.js has 324 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var _         = require('lodash');
    var uuid      = require('uuid');
    var logger    = require('yocto-logger');
    Severity: Minor
    Found in src/index.js - About 3 hrs to fix

      Function build has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Render.prototype.build = function (type) {
        // Is a valid type ?
        if (type === 'header' || type === 'footer') {
          // Build header data to inject on tempate
          var data = {
      Severity: Major
      Found in src/index.js - About 2 hrs to fix

        Function processRender has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        Render.prototype.processRender = function (res, template, param, nocache, onlydata, data) {
          // Setting up cache if undefined
          nocache = _.isBoolean(nocache) ? nocache : false;
          onlydata = _.isBoolean(onlydata) ? onlydata : false;
        
        
        Severity: Minor
        Found in src/index.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 buildAssetKeyValue has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Render.prototype.buildAssetKeyValue = function (reference, destination,
          keyLabel, valueLabel, stype) {
          // Structure is correct
          if (_.has(reference, stype) && _.isArray(reference[stype]) && !_.isEmpty(reference[stype])) {
            // Parse all reference
        Severity: Minor
        Found in src/index.js - About 1 hr to fix

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

          module.exports = function (grunt) {
            // Init config
            grunt.initConfig({
              // Default package
              pkg : grunt.file.readJSON('package.json'),
          Severity: Minor
          Found in Gruntfile.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                  if (check && _.isArray(destination) && !_.isUndefined(destination) &&
                      !_.isNull(destination)) {
                    // Need to build a fingerprint here ?
                    if (_.has(st, 'base64.enable') && st.base64.enable) {
                      // We need to check is an already query string exists or not in current url
            Severity: Critical
            Found in src/index.js - About 1 hr to fix

              Function processRender has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Render.prototype.processRender = function (res, template, param, nocache, onlydata, data) {
                // Setting up cache if undefined
                nocache = _.isBoolean(nocache) ? nocache : false;
                onlydata = _.isBoolean(onlydata) ? onlydata : false;
              
              
              Severity: Minor
              Found in src/index.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                  if (_.has(reference, stype) && _.isArray(reference[stype]) && !_.isEmpty(reference[stype])) {
                    // Parse all reference
                    _.each(reference[stype], function (stt) {
                      // Clone object
                      var st = _.clone(stt);
                Severity: Major
                Found in src/index.js - About 1 hr to fix

                  Function processRender has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  Render.prototype.processRender = function (res, template, param, nocache, onlydata, data) {
                  Severity: Minor
                  Found in src/index.js - About 45 mins to fix

                    Function updateConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Render.prototype.updateConfig = function (value) {
                      // Define meta rules
                      var metaHttpEquivRules = joi.object().keys({
                        name  : joi.string().required().not(null),
                        value : joi.string().required().not(null)
                    Severity: Minor
                    Found in src/index.js - About 45 mins 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

                    Consider simplifying this complex logical expression.
                    Open

                        if (type === 'header') {
                          // Default social obj
                          var socialObj = this.config.property.social || {};
                    
                          // Extend obj
                    Severity: Major
                    Found in src/index.js - About 40 mins to fix

                      Function buildAssetKeyValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      Render.prototype.buildAssetKeyValue = function (reference, destination,
                        keyLabel, valueLabel, stype) {
                      Severity: Minor
                      Found in src/index.js - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language