Showing 16 of 16 total issues
Function send
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
send() {
let args = [].slice.call(arguments),
code = 200, body;
let extension = _.getExtension(this.pathname);
- 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
App
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class App extends Base {
constructor(config, callback) {
super(config, callback);
this._middleware = new Middleware();
Function send
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
send() {
let args = [].slice.call(arguments),
code = 200, body;
let extension = _.getExtension(this.pathname);
Function dispatch
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
* dispatch() {
if (!this.pathname.startsWith("/public") && this.route != null && typeof this.route.handler === "function") {
if (!_.isGenerator(this.route.handler)) {
throw new Error("Route handler should be a generator function!");
}
- 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 exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(router, moduleName, optionalNamespace) {
// all routes for the particular module will be wrapped with namespace
let ns = router.ns(typeof optionalNamespace === "string" ? optionalNamespace : `/${moduleName.toLowerCase()}`);
function middleHandler(method) {
Function createServer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
* createServer(dispatcher) {
const serverConfig = this.config.get("server");
if (!serverConfig.protocol) {
throw new Error("Protocol is not set in the server config");
Function dispatch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
* dispatch() {
if (!this.pathname.startsWith("/public") && this.route != null && typeof this.route.handler === "function") {
if (!_.isGenerator(this.route.handler)) {
throw new Error("Route handler should be a generator function!");
}
Function readFileSafely
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
readFileSafely(filePath, callback) {
try {
filePath = decodeURIComponent(filePath); // decode url
} catch(e) {
callback(e);
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(_moduleName, indexFileAbsPath, routerFilePath, modelFiles) { // on module register
return function moduleMounter(context) { // run on app init, app's context
let wrappedRouter = function noop() {};
- 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 exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(handlerAbsPath) {
var handler = null;
// expects app's context as first argument, router instance, model register
return function handlerMounter(handlerContext/*, router, addModel*/) {
- 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 _lifeCircleAction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
* _lifeCircleAction(name, action) {
let actions = ["start", "stop", "restart"];
if (actions.indexOf(action) === -1) {
throw new Error(`Not supported action ${action} was received`);
- 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 isGenerator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
util.isGenerator = function(obj) {
/**
* Check if `obj` is a generator.
*
- 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 createServer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
* createServer(dispatcher) {
const serverConfig = this.config.get("server");
if (!serverConfig.protocol) {
throw new Error("Protocol is not set in the server config");
- 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 processExitHandler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static processExitHandler(options, err) {
options = options || {};
if (options.cleanup) { // TODO: cleanup
logger.info("Cleanup");
}
- 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 runSingle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
* runSingle(name, context) {
let _extension = this._findLoadedByName(name),
extensionConfig = this.getExtensionConfig(name);
if (!_.isObject(_extension)) {
- 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 loadConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
loadConfig() {
// set node config dir to app's home dir
this.config = configLib.loadConfig(this.initialConfig.confDir);
// node-config get function
let nodeConfigGetter = this.config.get.bind(this.config);
- 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"