Showing 54 of 106 total issues
Function evaluateMarker
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var evaluateMarker = function(exp,rc,store){
for(var marker in markers){
if(markers[marker].exp){
var regx = "^" + markers[marker].exp + "$";
var result = util.getMatches(exp.toString(),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 exports
has 29 lines of code (exceeds 25 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){
Function matchParamters
has 29 lines of code (exceeds 25 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] ){
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (data, dumpsdir, store, requestMatches){
//var regx = "\\[\\[([^\\]]+)\\]\\]";
var regx = "{{\\s*include\\(([^}]*)\\)\\s*}}";
var matches = util.getAllMatches(data,regx);
Function convertToFullNotationIfShort
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertToFullNotationIfShort(mapping){
if(mapping.request){
return mapping;
}else{
var fullNotation ={};
Function getFileName
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFileName (matchedentry) {
var res = matchedentry.response,
matches = matchedentry.request.matches;
if (res.file) {
Function convertToFullNotationIfShort
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function convertToFullNotationIfShort(mapping){
if(mapping.request){
return mapping;
}else{
var fullNotation ={};
- 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 getEncodingStream
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getEncodingStream(encodingHeader, response, dataStream){
let encodingName = encodingHeader;
if(encodingName === "*"){
encodingName = "gzip";
}
- 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 buildMappingFileContent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildMappingFileContent(req,res, options){
const mappingFileContent = {
request: {
method: req.method,
url: req.url,
Function _buildFromDirectory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_buildFromDirectory(dirPath){
this.config.datatables = joinPathIfExists(dirPath, "datatables");
this.config.stubs = joinPathIfExists(dirPath, "stubs");
this.config.dumps = joinPathIfExists(dirPath, "dumps");
this.config.recordAndPlay.path = joinPathIfExists(dirPath, "recordings");
- 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
Avoid deeply nested control flow statements. Open
if (key === '--port' || key === '-p') {
key = '-p';
} else if (key === '--config' || key === '-c') {
key = '-c';
} else if (key === '--host' || key === '-P' || key === '--mutualSSL') {
Function evaluate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
evaluate : function(result){
var today = exports.now();
for(var i = 1; i < result.length; i++) {
var match = result[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
Avoid deeply nested control flow statements. Open
if(!matches) return;
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(response, responseRecieved, fileName){
let encodingName = responseRecieved.headers["content-encoding"];
if(encodingName){
let encodingStream = supportedEncodings[ encodingName ];//when only one encoding name is given
if( !encodingStream ){//when multiple encoding schems are acceptable
- 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
Avoid deeply nested control flow statements. Open
if (res.strategy.indexOf("random") > -1) {
return this.getRandomFirstFound(res, matchedentry, matches);
} else if (res.strategy.indexOf("round-robin") > -1) {
return this.getRoundRobinFirstFound(res, matchedentry, matches,matchedentry.index);
}
Function evaluate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
evaluate : function(result){
var today = exports.nowJoda();
for(var i = 1; i < result.length; i++) {
var match = result[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
Avoid deeply nested control flow statements. Open
if(fileLevelMappings[i].response && fileLevelMappings[i].response.parser && typeof fileLevelMappings[i].response.parser === "string"){
fileLevelMappings[i].response.parser = {
type : fileLevelMappings[i].response.parser
};
}
Function _updateBasePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_updateBasePath(basePath){
this.config.datatables = joinPath(basePath , this.config.datatables);
this.config.stubs = joinPath(basePath , this.config.stubs);
this.config.dumps = joinPath(basePath , this.config.dumps);
- 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
Avoid deeply nested control flow statements. Open
if(matches && matches.length > 1){
matches = matches.slice(1);
clips = clips.concat(matches);
}
Function validateSyntax
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function validateSyntax(fileName) {
try {
if (fileName.endsWith(".json")) {
require('jsonlint').parse(fs.readFileSync(fileName, {
encoding: 'utf-8'
- 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"