Showing 100 of 387 total issues
Function inject
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function inject (request, fn, logger, imposterState) {
if (request.isDryRun) {
return Promise.resolve({});
}
Function respond
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function respond (payload, request, clientName, socket) {
let formattedRequestData = payload.toString(encoding);
if (formattedRequestData.length > 20) {
formattedRequestData = formattedRequestData.substring(0, 20) + '...';
}
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create (releases) {
function createNotice (release) {
return {
version: release.version,
when: date.howLongAgo(release.date)
Function wrap
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wrap (stub = {}) {
const cloned = helpers.clone(stub),
statefulResponses = repeatTransform(cloned.responses || []);
/**
Function proxyAndRecord
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function proxyAndRecord (responseConfig, request, logger, requestDetails, imposterState) {
const startTime = new Date(),
observeProxyDuration = metrics.proxyDuration.startTimer();
metrics.proxyCount.inc({ imposter: logger.scopePrefix });
Function create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create (config) {
let callbackURL,
proxy;
function setPort (port) {
Function selectTransform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function selectTransform (config, options, logger) {
const cloned = helpers.clone(config);
if (config.jsonpath) {
const stringTransform = options.shouldForceStrings ? forceStrings : combinators.identity;
- 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 resolveWithMetadata
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolveWithMetadata (possibleJSON) {
let metadata = {};
try {
metadata = JSON.parse(possibleJSON);
Function xpathSelect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function xpathSelect (selectFn, selector, doc) {
if (!helpers.defined(doc)) {
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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function create (config, logger) {
if (config.impostersRepository) {
const filename = path.resolve(path.relative(process.cwd(), config.impostersRepository));
if (fs.existsSync(filename)) {
- 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 load
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function load (builtInProtocols, customProtocols, options, isAllowedConnection, mbLogger, impostersRepository) {
Function selectJSONPath
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function selectJSONPath (config, encoding, predicateConfig, stringTransform, logger, text) {
Function execute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function execute (request, response, behaviors, logger, imposterState) {
Function addTypeErrors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function addTypeErrors (fieldSpec, path, field, config, addErrorFn) {
Function not
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function not (predicate, request, encoding, logger, imposterState) {
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function create (Protocol, creationRequest, baseLogger, config, isAllowedConnection) {
Function recordMatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function recordMatch (stub, request, response, responseConfig, start) {
Function processResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processResponse (responseConfig, request, logger, imposterState, requestDetails) {
Function or
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function or (predicate, request, encoding, logger, imposterState) {
Function decorate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function decorate (originalRequest, response, fn, logger, imposterState) {