Showing 37 of 141 total issues
Function decorate
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function decorate(req) {
/**
* Intiate a login session for `user`.
*
- 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 initialize
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
* initialize(next) {
let koa = this.koa;
logger("using leafjs body middleware");
- 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 initialize
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
* initialize(next) {
logger("using leafjs socketio middleware");
let leaf = this;
let koa = leaf.koa;
Function initialize
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
* initialize(next) {
yield * next;
logger("using leafjs controller middleware");
let leaf = this;
let koa = leaf.koa;
Function exports
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function( options ) {
options = options || {};
let hsts;
if (options.hsts) {
- 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 start
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
start(app, forConsole) {
let leaf = this;
leaf._forConsole = forConsole;
return new Promise((resolve, reject) => {
Function initialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
* initialize(next) {
yield * next;
logger("using leafjs controller middleware");
let leaf = this;
let koa = leaf.koa;
- 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 request
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
request(method, path, data, headers) {
logger(`calling general request helper: start`);
function _request(sc, path, nsp, method, data, headers, resolve, reject) {
let realPath = "";
Function initialize
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
* initialize(next) {
logger("using leafjs socketio middleware");
let leaf = this;
let koa = leaf.koa;
- 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 initialize
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
* initialize(next) {
let koa = this.koa;
logger("using leafjs body middleware");
Function constructor
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
function serviceUp(service) {
logger(`serviceup: ${service.type.name}`, service);
if (service.type.name !== "leaf") {
logger('ignoring service, service name not leaf');
Function bodyParseMiddleware
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
koa.use(function* bodyParseMiddleware(next) {
let body, parts;
let contentType = this.req.headers['content-type'],
contentLength = this.req.headers["content-length"],
transferEncoding = this.req.headers["transfer-encoding"];
Function handler
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handler(origHeaders) {
logger("delete accept-encoding in origHeaders");
delete origHeaders["accept-encoding"];
return function _handler(method, route, data, headers, cb) {
logger(`trigger socket.io s handler, with (${method}, ${route}, ${data}, ${headers})`);
Function constructor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
function serviceUp(service) {
logger(`serviceup: ${service.type.name}`, service);
if (service.type.name !== "leaf") {
logger('ignoring service, service name not leaf');
- 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 decorate
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function decorate(leaf, options) {
options = options || {};
let koa = leaf.koa;
// koa request
Function _handler
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function _handler(method, route, data, headers, cb) {
logger(`trigger socket.io s handler, with (${method}, ${route}, ${data}, ${headers})`);
if (undefined === cb) { //arguments is method, route, headers, cb
cb = headers;
headers = data;
Function decorate
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function decorate(req) {
/**
* Intiate a login session for `user`.
*
Function initialize
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
* initialize(next) {
logger("using leaf static server middleware");
let leaf = this;
let koa = this.koa;
Function startServer
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
let serverMw = function* startServer(next) {
logger("require pmx and initalizing");
require("pmx").init();
yield * next;
Function staticServer
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
koa.use(function* staticServer(next) {
let path = options.uri;
if (this.request.path) {
if (leaf.namespace && leaf.namespace !== "/") {
path = leaf.namespace + path;