Showing 50 of 580 total issues
Function exports
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports = module.exports = function(settings){
var precompile = settings.precompile;
if ( void 0 === precompile ) {
precompile = false;
}
Function handler
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handler(origHeaders) {
delete origHeaders["accept-encoding"];
debug("handler with origHeader");
return function _handler(method, route, data,headers, cb) {
Function Browser
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
var Browser=function(){
// first search for all possible mdns
// locate the first dnscache
// if not located, continue caching everything
// once located, switch off all browser, and start listening to only dnscache
- 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 _handler
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function _handler(method, route, data,headers, cb) {
debug("handler here");
debug(`entering into sio handler with (${method}, ${route}, ${data}, ${headers})`);
if ( undefined === cb ) { cb = headers; headers = data; }
if ( undefined === headers ) { cb = data; }
Function decorate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function decorate(req){
/**
* Intiate a login session for `user`.
*
Function setup
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setup: function*(next) {
// precompile all files to .tmp
debug("Reaching koala puree dust middleware");
var app = this._app;
var dust;
Function Browser
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Browser=function(){
// first search for all possible mdns
// locate the first dnscache
// if not located, continue caching everything
// once located, switch off all browser, and start listening to only dnscache
Function startServer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function* startServer(next){
debug("starting startServer Mw");
require("pmx").init();
var server;
yield* next;
Function _reverseLocate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
schema.static("findBy"+name, function _reverseLocate(id){
if ( id._id ) {
id = id._id;
}
var self = this;
Function _getRelation
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
schema.method(methodName, function _getRelation(){
var self = this;
var query = this._orientose()
._db
.select()
Function middleware
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
middleware: function(){
return {
setup: function *(next) {
var app = this;
yield (new Promise(function(resolve/*, reject*/){
Function advertise
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function advertise(self) {
if ( self._ad ) { self._ad.stop(); }
debug("Starting mdns middleware");
debug(self._config);
var adSettings = {
Consider simplifying this complex logical expression. Open
Open
if (!app._config.db || !app._config.db.url) {
let config = app._config.db || {};
let username = config.username || "root";
let password = config.password || "root";
let host = config.host || "localhost";
Function get
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get: function(name, ver) {
var time = new Date();
// think of a way to refactor this into a generator, so we can just store that as a cache and yield everytime
// hopeful usage would be:
// var service = cache[service@version].next();
Function constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
constructor(mod, config) {
super();
var closestPath = closest.sync(require("path").dirname(mod.filename));
this._basePath = require("path").dirname(closestPath);
var pkginfo = require("@shekhei/pkginfo")(mod);
- 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 listen
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
app.listen = function listen(port, cb, options) {
if (typeof port === "function") options = cb, cb = port, port = null;
if ( options === undefined && typeof cb !== "function" ) options = cb, cb = undefined;
options = options || {};
Function seed
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
seed: function(app) {
return new Promise(function(resolve, reject){
glob(require("path").resolve(app._basePath, "db/seed/*.js"), function(er, files) {
if (er) {
return reject(er);
Function resolver
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resolver() {
debug("looping through browser caches");
// keep trying for a specific amount of time, now hard coded, 1s
if ( new Date() - time > 2000 ) { debug("timeout"); return reject(); }
if ( name in globalDnsCache ) {
Function body
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.req.body = function*(){
debug("body generator");
debug("req.body req headers:",self.req.headers);
if ( !self.req.headers["content-length"] && !self.req.headers["transfer-encoding"] ) {
Consider simplifying this complex logical expression. Open
Open
if ( "link" in rel || "in" in rel || "out" in rel || "both" in rel ) {
var cond = rel.link || rel.in || rel.out || rel.both;
var reverseCond;
if ( "link" !== rel.linkType ) {
if ( rel.in ) {