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
- Read upRead up
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)
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');
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 = {
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;
- Read upRead up
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
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'),
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
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;
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);
Function processRender
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Render.prototype.processRender = function (res, template, param, nocache, onlydata, data) {
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)
- Read upRead up
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
Function buildAssetKeyValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Render.prototype.buildAssetKeyValue = function (reference, destination,
keyLabel, valueLabel, stype) {