src/extensions/default/StaticServer/node/StaticServerDomain.js
Function init
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("staticServer")) {
domainManager.registerDomain("staticServer", {major: 0, minor: 1});
Function _createServer
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _createServer(path, port, createCompleteCallback) {
var server,
app,
address,
pathKey = getPathKey(path);
File StaticServerDomain.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (c) 2012 - present Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Function _createServer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
function _createServer(path, port, createCompleteCallback) {
var server,
app,
address,
pathKey = getPathKey(path);
- 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 rewrite
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function rewrite(req, res, next) {
var location = {pathname: parse(req).pathname},
hasListener = _rewritePaths[pathKey] && _rewritePaths[pathKey][location.pathname],
requestId = _filterRequestCounter++,
timeoutId;