Showing 9 of 21 total issues
Function optimist
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function optimist() {
var usage = [
pkginfo.name + ' v' + pkginfo.version,
'',
'A utility for UI developers to proxy JSON API calls to remote servers',
- Create a ticketCreate a ticket
Function parseCommandLine
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseCommandLine(argv, config) {
if (argv) {
// read the command line arguments if no config file was given
parseCommandLineArgument(argv.port, function(item){
config.server.port = item;
- Create a ticketCreate a ticket
Function proxyRequest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function proxyRequest(req, res, rule) {
var router,
target,
path;
- Create a ticketCreate a ticket
Function parseEnv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function parseEnv(config) {
var env = process.env;
var temp;
if (env['JSON_PROXY_PORT']) {
- Read upRead up
- Create a ticketCreate a ticket
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 parseFile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function parseFile(filepath, config) {
var contents;
filepath = filepath || path.join(process.cwd(), '/json-proxy.json');
- Read upRead up
- Create a ticketCreate a ticket
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 7 (exceeds 5 allowed). Consider refactoring. Open
exports.initialize = function initialize(options){
logger = options.logger || require('./logger');
config = configParser(options).proxy;
useGateway = (config.gateway !== null && typeof(config.gateway) === 'object' && typeof(config.gateway.host) === 'string');
- Read upRead up
- Create a ticketCreate a ticket
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 proxyRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function proxyRequest(req, res, rule) {
var router,
target,
path;
- Read upRead up
- Create a ticketCreate a ticket
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 parseCommandLineArgument
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parseCommandLineArgument(arg, fn) {
if (typeof(fn) !== 'function')
return;
if (Array.isArray(arg)) {
- Read upRead up
- Create a ticketCreate a ticket
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 parseTargetServer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parseTargetServer(value) {
var target,
path;
// insert a http protocol handler if not found in the string
- Read upRead up
- Create a ticketCreate a ticket
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"