Showing 32 of 54 total issues
Function exports
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
/**
* Server listening port.
*/
config.port = (process.env.PORT || 3000);
Function init
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
loader.init = function*(options) {
if (loader[$FILE]) {
debug('Waigo was already initialised. Re-initialising...');
loader.reset();
File user.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
const crypto = require('crypto');
const waigo = global.waigo,
Function exports
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(options) {
return function*(context, field, value) {
let fields = field.form.fields,
otherField = fields[options.field]
- 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 init
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
loader.init = function*(options) {
if (loader[$FILE]) {
debug('Waigo was already initialised. Re-initialising...');
loader.reset();
- 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 process
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
* process (token, options) {
options = options || {};
this.logger.debug(`Processing action token: ${token}`);
Function exports
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(options) {
return function*(context, field, value) {
let fields = field.form.fields,
otherField = fields[options.field]
Function run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
* run () {
if (!this.fileExists('package.json')) {
return this.log('Please run "npm init" first');
}
Function exports
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(App, options) {
return function*(next) {
this.App.logger.debug('assertUser is logged in');
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 _buildRoutes
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
_buildRoutes (commonMiddleware, urlPath, node, parentConfig) {
urlPath = parentConfig.urlPath + urlPath;
logger.debug('Build route', urlPath);
Function exports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(App, options) {
let enabledFormats = {};
let formatNames = Object.keys(options.formats);
Function getAccessToken
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
* getAccessToken (code) {
let user = this._user();
this.logger.info(`Get access token: user=${user ? user.id : 'anon'} code=${code}`);
Function register
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
register: function*(properties) {
// create user
let attrs = {
username: properties.username,
emails: [],
Function setup
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
* setup (middlewareConfig, routeConfig) {
logger.info('Initialise...');
require('koa-trie-router')(this.App.koa);
Function toViewObjectYieldable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const toViewObjectYieldable = exports.toViewObjectYieldable = function(inputObject, ctx) {
if (inputObject) {
// if it's one of our model schema types
// (see https://github.com/hiddentao/simple-nosql-schema)
Function validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
* validate (context) {
let errors = [];
// if value is undefined and field is not required then nothing to do
if (undefined === this.value || null === this.value || '' === this.value) {
- 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 toViewObjectYieldable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const toViewObjectYieldable = exports.toViewObjectYieldable = function(inputObject, ctx) {
if (inputObject) {
// if it's one of our model schema types
// (see https://github.com/hiddentao/simple-nosql-schema)
- 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 createUserAndLogin
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function* createUserAndLogin(next) {
let ctx = this.context,
App = ctx.App,
User = App.models.User;
Function _send
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
* _send (mailOptions) {
let self = this;
mailOptions = yield self._prepareMailOptions(mailOptions);
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(App, options) {
return function*(next) {
this.App.logger.debug('assertUser is logged in');
try {