Showing 54 of 106 total issues
Function matchParamters
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function matchParamters(http_request, mapped_request, param_name){
var clips = [];
clips[0] = "N/A";
if( !http_request[param_name]){
if( mapped_request[param_name] ){
- 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 buildMappings
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
buildMappings(mappingFiles, allMappings){
var fileLevelMappings;
allMappings = allMappings || [];
//defaultConfig = config.mappings.default || defaultConfig;
defaultConfig = deepAssign({},defaultConfig, this.options.mappings.default);
- 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 buildServerOptions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function buildServerOptions(args) {
var options = {};
for (var i = 2; i < args.length; i++) {
if (args[i].indexOf("-") === 0) {
var key = args[i];
- 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 process
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
process(request, response, onSuccess, onError){
var rc = new RequestContext(request);
logger.info(rc.getTransactionId() + " " + request.method+": "+request.url,'green');
- 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 getFileName
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
getFileName (matchedentry) {
var res = matchedentry.response,
matches = matchedentry.request.matches;
if (res.file) {
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (data, dumpsdir, store, requestMatches){
//var regx = "\\[\\[([^\\]]+)\\]\\]";
var regx = "{{\\s*include\\(([^}]*)\\)\\s*}}";
var matches = util.getAllMatches(data,regx);
- 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 matchAndCapture
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function matchAndCapture(mapped_request, http_request){
var matched = {}, i=0;
if(Array.isArray(mapped_request.method)){
if(mapped_request.method.indexOf(http_request.method) === -1) return;
- 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 process
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
process(request, response, onSuccess, onError){
var rc = new RequestContext(request);
logger.info(rc.getTransactionId() + " " + request.method+": "+request.url,'green');
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(data, mappedEntry, source){
var regx = "{{\\s*(.*)\\s*}}";
var expressions = util.getAllMatches(data,regx);
var dataTableRegex = "#(([\\w]+)|(([\\w]+)(\\[\\s*([0-9]+)\\s*\\])?)(\\((.*?)\\))?\.([\\w]+))";
for(var i in expressions){
- 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 parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
parse(http_request, mappings, dataTables){
for(var i=0;i<mappings.length;i++){
var entry = util.clone(mappings[i]);
var matched = matchAndCapture(entry.request, http_request);
if(matched){//if nothing matches in current mapping, check for other matching
- 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 build
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
build(options){
this.config = {
mappings: {},
server:{},
recordAndPlay : {
Function buildServerOptions
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildServerOptions(args) {
var options = {};
for (var i = 2; i < args.length; i++) {
if (args[i].indexOf("-") === 0) {
var key = args[i];
Function buildFunctionExp
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var buildFunctionExp = function(exp){
var paramStart = 0, startIndex = 0;
var inFunction = false, nestedFunction = false;
var args = [];
for(var i=0;i<exp.length;i++){
- 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 buildMappings
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildMappings(mappingFiles, allMappings){
var fileLevelMappings;
allMappings = allMappings || [];
//defaultConfig = config.mappings.default || defaultConfig;
defaultConfig = deepAssign({},defaultConfig, this.options.mappings.default);
Function redirect
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function redirect(request, response, requestProcessor, baseUrl, options){
const targetUrl = url.resolve(baseUrl, request.originalUrl);
const reqOptions = {
url: targetUrl,
method: request.method,
Function reload
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
reload(){
this.tables = [];
if(this.source){
try{
var files = fs.readdirSync(this.source);
Function requestResponseHandler
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requestResponseHandler(request, response, requestProcessor) {
request.originalUrl = request.url;
var parsedURL = url.parse(request.url, true);
request.url = parsedURL.pathname;
Function ls
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.ls = function(dirpath, ext){
if(exports.isExist(dirpath)){
const fileList = fs.readdirSync(dirpath);
if(ext){
const filteredFileList = [];
- 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 evaluate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.evaluate = function(exp,rc,store){
if(isFunction(exp)){
var fExp = buildFunctionExp(exp);
for (var i = 0; i < fExp.args.length; i++) {
- 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 build
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
build(options){
this.config = {
mappings: {},
server:{},
recordAndPlay : {
- 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"