Showing 220 of 414 total issues
Avoid deeply nested control flow statements. Open
Open
for (var v in verbs) {
var verb:string = verbs[v];
if (this.holder.routes[model][verb].indexOf(role) == -1) {
if (!result[role][model]) {
result[role][model] = {};
Avoid deeply nested control flow statements. Open
Open
if (type.type == 'date') {
pathO.options.default = pathO.options.default.toISOString();
}
Avoid deeply nested control flow statements. Open
Open
if (route.hasOwnProperty(role)) {
var userRole = route[role];
if (!result[userRole])
result[userRole] = {};
if (!result[userRole][modelName])
Avoid deeply nested control flow statements. Open
Open
if (type.items.type == 'object') {
// TODO: Pass to the the parseSchema the current path
parseSchema(pathO.schema, obj[path].items.properties, pathO.path);
} else {
type = getType(pathString, pathO.caster.instance);
Avoid deeply nested control flow statements. Open
Open
for (var v in verbs) {
var verb = verbs[v];
if (this.holder.routes[model][verb].indexOf(role) == -1) {
if (!result[role][model]) {
result[role][model] = {};
Function Configurations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
var Configurations = /** @class */ (function () {
function Configurations() {
if (Configurations.configHolder) {
throw new Error("Don't instantiate directly a configuration");
}
- 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 deeply nested control flow statements. Open
Open
if (route.hasOwnProperty(role)) {
var userRole = route[role];
if (!result[userRole])
result[userRole] = {};
Function denormalize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports.denormalize = function (field, rkey, Model, isArray, fullPath) {
Function runPostCallbacks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports.runPostCallbacks = function (config, req, res, value, cbk) {
Function runPreCallbacks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports.runPreCallbacks = function (preFnArray, Model, req, res, cbk) {
Function iterate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports.iterate = function it(fullPath, doc, iterator, callback, parents) {
Function runBeforeDatabaseCallbacks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
TypeBased.runBeforeDatabaseCallbacks = function (operation, model, req, res, cb) {
Function transform
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function transform(Model, key, fullKey, modelConfig, field) {
Function findOneWithValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
QueryUtils.findOneWithValue = function (operation, model, req, value, cb) {
Function trim
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function trim (arg) {
var match = arg.match(/^function\s*[^\(]*\([^\)]*\)\s*{/);
if (!match) throw error(arg);
// we included the first "{" in our match
- 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
Open
return [4 /*yield*/, util_2.promisify(fs.exists)(outputFile)];
Avoid too many return
statements within this function. Open
Open
return next();
Avoid too many return
statements within this function. Open
Open
return [3 /*break*/, 5];
Avoid too many return
statements within this function. Open
Open
return [3 /*break*/, 13];
Avoid too many return
statements within this function. Open
Open
if (!!(_b.sent())) return [3 /*break*/, 4];