Showing 10 of 35 total issues
Function getExpress
has 367 lines of code (exceeds 25 allowed). Consider refactoring. Open
Schema.prototype.getExpress = function () {
// Default schema
var schema = {
// Default app rules
app : joi.object().required().keys({
File schema.js
has 560 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var joi = require('joi');
var _ = require('lodash');
var utils = require('yocto-utils');
Function getRender
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Schema.prototype.getRender = function () {
// Define meta rules
var metaHttpEquivRules = joi.object().keys({
name : joi.string().required().not(null),
value : joi.string().required().not(null)
Function load
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Config.prototype.load = function () {
// Create async process here
var deferred = Q.defer();
// Any errors ?? try/catch it
Function exports
has 50 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'),
Function getMongoose
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Schema.prototype.getMongoose = function () {
// Native parser. Exclude it because underscore keys is not a good practicies and hint failed
// transformation will process at the end
var nParser = {
nativeParser : joi.boolean().default(false)
Function getPassportJs
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Schema.prototype.getPassportJs = function () {
// Default validation schema
var baseSchema = {
identifier : joi.string().required().empty().default(null),
secret : joi.string().required().empty(),
Function find
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Config.prototype.find = function (name, complete) {
// Message
this.logger.debug([ '[ Config.find ] - Try to enable config for', name ].join(' '));
// Search item
- 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 autoEnableValidators
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Config.prototype.autoEnableValidators = function (items) {
// Is valid format ?
if (!_.isArray(items) || _.isEmpty(items)) {
// Warn message invalid data
this.logger.warning([ '[ Config.autoEnableValidator ] - Cannot check items.',
- 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 set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Config.prototype.set = function (name, value) {
// Check requirements
if (!_.isUndefined(name) && _.isString(name) && !_.isEmpty(name)) {
// Need to normalize path ?
if (name === 'base') {
- 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"