Showing 100 of 386 total issues
Function loadProtocols
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function loadProtocols (options, baseURL, logger, isAllowedConnection, imposters) {
Function inject
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function inject (predicate, request, encoding, logger, imposterState) {
Function proxyAndRecord
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function proxyAndRecord (responseConfig, request, logger, requestDetails, imposterState) {
Function or
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function or (predicate, request, encoding, logger, imposterState) {
Function evaluate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function evaluate (predicate, request, encoding, logger, imposterState) {
Function processResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processResponse (responseConfig, request, logger, imposterState, requestDetails) {
Function select
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function select (selector, possibleJSON, logger) {
const isObject = helpers.isObject;
try {
const json = isObject(possibleJSON) ? possibleJSON : JSON.parse(possibleJSON),
- 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 howLongAgo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function howLongAgo (thenText, testNowText) {
const nowText = testNowText ? testNowText : new Date(Date.now()).toISOString(), // testNow is just for testing purposes
then = toEpochWithoutTime(thenText),
now = toEpochWithoutTime(nowText),
millisecondsInDay = 24 * 60 * 60 * 1000,
- 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 getFrom
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getFrom (obj, from) {
const isObject = helpers.isObject;
if (typeof obj === 'undefined') {
return undefined;
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function create () {
const imposters = {},
stubRepos = {};
/**
- 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 too many return
statements within this function. Open
return predicateSatisfied(expected[fieldName], actual[fieldName], predicateConfig, predicateFn);
Avoid too many return
statements within this function. Open
return value;
Avoid too many return
statements within this function. Open
return testPredicate(expected[fieldName], actual[fieldName], predicateConfig, predicateFn);
Avoid too many return
statements within this function. Open
return Promise.reject(exceptions.ValidationError('unrecognized response type',
{ source: helpers.clone(responseConfig) }));
Avoid too many return
statements within this function. Open
return 'this month';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return this.inMemory();
Function parseLogConfiguration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parseLogConfiguration (args) {
// Not defaulted in yargs so we can test yargs value without defaulting interfering.
// This is needed for backwards compatibility with older CLI options.
const defaultConfig = {
level: 'info',
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function create (logfile) {
function getLogEntries () {
if (!logfile || !fs.existsSync(logfile)) {
return [{ level: 'error', message: 'No logfile' }];
}
- 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 rawArgvIndexFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function rawArgvIndexFor (key) {
// Use raw process.argv to ensure user actually passed the parameter, bypassing
// yargs defaulting. Also check alias.
let index = process.argv.indexOf(`--${key}`);
if (index < 0) {
- 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"