Showing 12 of 37 total issues
Function generateAsciiCharsList
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
Str.prototype.generateAsciiCharsList = function (alpha, num, special, toLower) {
// Default chars for appending
var s = '';
// Generate list
- 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 generateList
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
// Default list
var list = [];
try {
- 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 generateList
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
// Default list
var list = [];
try {
Function exports
has 40 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 randomizedPassword
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Crypto.prototype.randomizedPassword = function (n, level) {
// Choose complexity level of password
// 1 : easy - 2 middle - 3 huge
level = !_.isUndefined(level) && _.isNumber(level) && (level >= 1 && level <= 3) ? level : 3;
- 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 (i >= 33 && i <= 47 || i >= 58 && i <= 64 || i >= 91 && i <= 96 || i >= 123 && i <= 126) {
s += String.fromCharCode(i);
}
Function randomizedPassword
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Crypto.prototype.randomizedPassword = function (n, level) {
// Choose complexity level of password
// 1 : easy - 2 middle - 3 huge
level = !_.isUndefined(level) && _.isNumber(level) && (level >= 1 && level <= 3) ? level : 3;
Function walk
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ObjUtil.prototype.walk = function (obj) {
// First test
if (!obj || !_.isObject(obj)) {
// Default statement
return obj;
- 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 generateList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
Function calculDifference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function (actualDate, limitDate, difference, firstPassage) {
// Find a valid day from the actualDate
var validDate = this.findNextValidDay(actualDate);
// Check if the validDate is not BetweenOpenPlanning & if isBefore the limitDate
- 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
Avoid too many return
statements within this function. Open
return _.reduce(Object.keys(obj), function (acc, key) {
// Camelcase
var state = this.camelize ? this.str.camelCase(key) : this.str.underscore(key);
// Assign
Function isSpecialChar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Str.prototype.isSpecialChar = function (value) {
// Char At zero
var zero = value.charCodeAt(0);
// Default statement
- 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"