Showing 46 of 48 total issues
Function REST_POST_SINGLE
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
export async function REST_POST_SINGLE (Model, model, entity = null) {
if (!entity) {
entity = await Model.create(model);
}
let modelRelations = {};
- Read upRead up
- Create a ticketCreate a ticket
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
File error.js
has 454 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** @ignore */
let codes = [
{
'code': '1xx',
'phrase': '**Informational**',
- Create a ticketCreate a ticket
Function RestModel
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
export function RestModel (options, route, modelname) {
let routers = {
public: new Router(),
private: new Router()
};
- Read upRead up
- Create a ticketCreate a ticket
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 oauth2server
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function oauth2server () {
AuthModel = models[inflector.pluralize(configuration.security.model)];
for (let model in oauth2models) {
addModel(inflector.pluralize(model), oauth2models[model]);
}
- Create a ticketCreate a ticket
Function RestModel
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function RestModel (options, route, modelname) {
let routers = {
public: new Router(),
private: new Router()
};
- Create a ticketCreate a ticket
Function default
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function (model) {
for (const fn of promesifythem) {
if (model[fn]) {
const rawFN = model[fn].bind(model);
model.rawAPI[fn] = rawFN;
- Create a ticketCreate a ticket
Function default
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export default function (model) {
for (const fn of promesifythem) {
if (model[fn]) {
const rawFN = model[fn].bind(model);
model.rawAPI[fn] = rawFN;
- Read upRead up
- Create a ticketCreate a ticket
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 REST_POST_SINGLE
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function REST_POST_SINGLE (Model, model, entity = null) {
if (!entity) {
entity = await Model.create(model);
}
let modelRelations = {};
- Create a ticketCreate a ticket
Function restify
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export async function restify (modelinstance, /* istanbul ignore next */ relations = {}, /* istanbul ignore next */MODEL = {}) {
/* istanbul ignore next */
let model = modelinstance.toJSON ? modelinstance.toJSON() : modelinstance;
for (const key of Object.keys(relations)) {
const keyTo = relations[key].keyTo === 'id' ? '_id' : relations[key].keyTo;
- Read upRead up
- Create a ticketCreate a ticket
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 initialize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export function initialize () {
subdomainRouters = {
www: new KoatonRouter('www')
};
let routers = glob('koaton_modules/**/routes.js').concat(glob('routes.js'));
- Read upRead up
- Create a ticketCreate a ticket
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 addModel
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function addModel (modelName, definition) {
relations[modelName] = [];
const rel = {
belongsTo: relation.bind(modelName, 'belongsTo'),
hasMany: relation.bind(modelName, 'hasMany'),
- Create a ticketCreate a ticket
Function restify
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function restify (modelinstance, /* istanbul ignore next */ relations = {}, /* istanbul ignore next */MODEL = {}) {
/* istanbul ignore next */
let model = modelinstance.toJSON ? modelinstance.toJSON() : modelinstance;
for (const key of Object.keys(relations)) {
const keyTo = relations[key].keyTo === 'id' ? '_id' : relations[key].keyTo;
- Create a ticketCreate a ticket
Function initialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initialize () {
subdomainRouters = {
www: new KoatonRouter('www')
};
let routers = glob('koaton_modules/**/routes.js').concat(glob('routes.js'));
- Create a ticketCreate a ticket
Function ex2engine
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function ex2engine (fullpath) {
let extension = extname(fullpath).slice(1);
let file = fullpath.replace(extname(fullpath), '');
let engine;
if (!extension && !cacher[fullpath] && !exists(fullpath)) {
- Read upRead up
- Create a ticketCreate a ticket
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 loadSecurityContext
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadSecurityContext () {
AuthModel = models[inflector.pluralize(configuration.security.model)];
const Model = models[inflector.pluralize(configuration.security.model)];
/* istanbul ignore if */
if (!Model) {
- Read upRead up
- Create a ticketCreate a ticket
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 cached
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default async function cached (ctx, next) {
await next();
const body = ctx.body;
/* istanbul ignore if */
if (!body || ctx.response.get('ETag') || ctx.state.nocache) return;
- Read upRead up
- Create a ticketCreate a ticket
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 REST_GET
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
pOrp(routers, options.get).get('/', async function REST_GET (ctx, next) {
let res = {},
filteroptions = { skip: 0 };
filteroptions.limit = isNaN(ctx.query.size) ? isNaN(configuration.server.pagination.limit) ? /* istanbul ignore next */50 : configuration.server.pagination.limit : parseInt(ctx.query.size, 10);
if (ctx.query.size) {
- Create a ticketCreate a ticket
Function DeepDevOrProd
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function DeepDevOrProd (object, prop) {
let target = object[prop];
if (Object.keys(target).indexOf('dev') === -1 && typeof target === 'object') {
for (const deep of Object.keys(target)) {
DeepDevOrProd(object[prop], deep);
- Read upRead up
- Create a ticketCreate a ticket
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 oauth2server
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function oauth2server () {
AuthModel = models[inflector.pluralize(configuration.security.model)];
for (let model in oauth2models) {
addModel(inflector.pluralize(model), oauth2models[model]);
}
- Read upRead up
- Create a ticketCreate a ticket
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 nunjucks
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function nunjucks () {
const nunjucks = require(ProyPath('node_modules', 'nunjucks'));
const env = new nunjucks.Environment();
class Link {
constructor () {
- Create a ticketCreate a ticket