Showing 48 of 48 total issues
Function loadSecurityContext
has 33 lines of code (exceeds 25 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) {
- Create a ticketCreate a ticket
Function manyToMany
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
manyToMany (configuration) {
let targetModel = inflector.pluralize(configuration.targetModel);
let intermediateTable = `${modelName}_${targetModel}`;
let key1 = `${modelName}ID`;
let key2 = `${targetModel}ID`;
- Create a ticketCreate a ticket
Function initializeORM
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initializeORM (seed) {
let res = null;
/* istanbul ignore next */
schema.on('error', (err) => {
debug(err.stack);
- Create a ticketCreate a ticket
Function rest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
rest (url, model) {
if (model === undefined) {
model = url;
url = undefined;
}
- Create a ticketCreate a ticket
Function subdomainrouter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export default async function subdomainrouter (ctx, next) {
ctx.subdomain = 'www';
for (const subdomain of configuration.server.subdomains) {
if (ctx.request.host.indexOf(subdomain) === 0) {
ctx.state.subdomain = subdomain;
- 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 makeLink
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function makeLink (ctx, url, render) {
let route = KoatonRouter.AllRoutes(ctx.subdomain).map(exp => {
let variables = (exp[1].match(/\$/g) || []).length;
let matches = (url.match(exp[0]) || []).length - 1;
if (matches === variables && url.replace(...exp).indexOf('.') === -1) {
- 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 getQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getQuery (database, model, filtergroup) {
let group = [];
for (let index in filtergroup) {
let filter = filtergroup[index];
if (filter.key.indexOf('.') > -1) {
- Create a ticketCreate a ticket
Function start
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
App.start = function (port, usehttp2 = false) {
for (const route of koaton.router.options()) {
App.use(route);
}
let callback = () => {
- Create a ticketCreate a ticket
Function token
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function token (ctx, next) {
await next();
ctx.state = {
data: {
client: await models.oauth2applications.findOne({
- Create a ticketCreate a ticket
Function request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
request (method, url, binding = 'index', secured = false) {
let Action;
if (typeof binding === 'boolean') {
secured = binding;
binding = 'index';
- Create a ticketCreate a ticket
Function makerelation
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makerelation (model, relation) {
let options = {
as: relation.As,
foreignKey: relation.key
};
- Create a ticketCreate a ticket
Function getQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function getQuery (database, model, filtergroup) {
let group = [];
for (let index in filtergroup) {
let filter = filtergroup[index];
if (filter.key.indexOf('.') > -1) {
- 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 prepareQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function prepareQuery (database, model, query, item) {
let [modelname, property] = item.split('.');
let prequery = {};
let value = (query.value ? query.value : query[item]);
value = query.condition === '===' ? value : (property === 'id' ? value : new RegExp(`.*${value}.*`));
- Create a ticketCreate a ticket
Function oauth2application
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
oauth2application (schema) {
return {
'model': {
'ClientId': {
type: schema.String
- Create a ticketCreate a ticket
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor () {
/** @type {Object} */
this.bundles = null;
/** @type {Object} */
this.conections = null;
- Create a ticketCreate a ticket
Function oauth2accesstoken
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
oauth2accesstoken (schema) {
return {
'model': {
'UserId': {
type: schema.String
- Create a ticketCreate a ticket
Function rawWhere
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
model.rawWhere = function rawWhere (stringquery, opts) {
let that = this;
return new Promise(function (resolve, reject) {
let where = that.$where(stringquery);
for (let prop in opts) {
- Create a ticketCreate a ticket
Function start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
App.start = function (port, usehttp2 = false) {
for (const route of koaton.router.options()) {
App.use(route);
}
let callback = () => {
- 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 request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
request (method, url, binding = 'index', secured = false) {
let Action;
if (typeof binding === 'boolean') {
secured = binding;
binding = 'index';
- 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 buildFilterSet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function buildFilterSet (query, model, database) {
let filterset = query.filterset || [];
if (query.filterset) {
delete query.filterset;
}
- 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"