Showing 57 of 125 total issues
Function routes
has 323 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const routes = application => {
return new Promise(resolve => {
const app = application;
const references = app.get('references');
- Create a ticketCreate a ticket
Function routes
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const routes = application => {
return new Promise(resolve => {
const app = application;
const references = app.get('references');
- Create a ticketCreate a ticket
File content.js
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
/*
* @fileoverview Content system routing
*
- Create a ticketCreate a ticket
Function attributes
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const attributes = (attrs, model, models, query, trx) => {
const params = _.cloneDeep(query) || {};
const result = {};
let references = {};
- Create a ticketCreate a ticket
Function one
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const one = (req, res, next) => {
const id = _.get(req.session, 'form.applications.edit.id', null);
const errors = _.get(req.session, 'form.applications.save.errors', {});
const values = _.get(req.session, 'form.applications.save.content', {});
const merged = req.app.get('applications-merged') || {};
- Create a ticketCreate a ticket
File utils.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const _ = require('lodash');
const database = require('../database');
- Create a ticketCreate a ticket
Function save
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const save = (req, res, next) => {
const id = _.get(req.session, 'form.users.edit.id', null);
const referrer = (_.get(req.session, 'referrer') || req.get('Referrer')) || `/${config.users.base}`;
let merged = req.app.get('users-model') || {};
- Create a ticketCreate a ticket
Function one
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const one = (req, res, next) => {
const id = _.get(req.session, 'form.users.edit.id', null);
const errors = _.get(req.session, 'form.users.save.errors', {});
const values = _.get(req.session, 'form.users.save.content', {});
const merged = req.app.get('users-model') || {};
- Create a ticketCreate a ticket
Function check
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
const check = (config) => {
if (!config.hasOwnProperty('name')) {
return 'Workflows require a name';
}
- 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
Consider simplifying this complex logical expression. Open
Open
if ((!req.isAuthenticated || !req.isAuthenticated()) && !req.url.startsWith('/create-admin') && req.url !== config.authentication.login.path && !req.url.startsWith('/css') && !req.url.startsWith('/js') && !req.url.startsWith('/images') && !req.url.startsWith('/favicon') && !req.url.startsWith('/api') && !req.url.startsWith('/tmp') && req.url !== '/robots.txt') {
res.redirect('/login');
}
else {
// consistent-return turned off because this doesn't return a value
- Create a ticketCreate a ticket
Function format
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const format = body => {
const data = {};
const single = Object.keys(body).filter(input => {
if ((input === 'sunset-date') || (input === 'sunset-time') || (input === 'sunrise-date') || (input === 'sunrise-time')) {
data[input] = { 'value': body[input] };
- Create a ticketCreate a ticket
Function save
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const save = (req, res) => {
const id = _.get(req.session, 'form.applications.edit.id', null);
const referrer = (_.get(req.session, 'referrer') || req.get('Referrer')) || `/${config.applications.base}`;
const merged = req.app.get('applications-merged') || {};
let apps = req.app.get('applications-apps') || [];
- Create a ticketCreate a ticket
File routes.js
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
/**
* @fileoverview User routing functions
*
- Create a ticketCreate a ticket
Function fill
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const fill = (types, type, refs, database) => {
const ct = _.cloneDeep(type);
if (!ct) {
return new Promise(resolve => {
- Create a ticketCreate a ticket
Function organize
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const organize = (query, custom) => {
const params = query || {};
let lookup = custom;
if (lookup && !Array.isArray(lookup)) {
- Create a ticketCreate a ticket
Function format
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const format = (content, attrs, models, query, trx) => {
const params = _.cloneDeep(query) || {};
let atrs = attrs || [];
const mods = _.cloneDeep(models) || [];
- Create a ticketCreate a ticket
Function filehold
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const filehold = (files, val, attributes) => {
const values = val;
if (!files || !Array.isArray(files) || !values || typeof values !== 'object' || !attributes || typeof attributes !== 'object') {
return values;
- Create a ticketCreate a ticket
Function references
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const references = (types) => {
const cts = _.cloneDeep(types);
const refs = [];
const position = {};
- Create a ticketCreate a ticket
Function push
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const push = (revision, apps) => {
const options = {
trigger: 'updated',
apps,
};
- Create a ticketCreate a ticket
Function check
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const check = (config) => {
if (!config.hasOwnProperty('name')) {
return 'Workflows require a name';
}
- Create a ticketCreate a ticket