src/models/predicates.js
File predicates.js
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const stringify = require('safe-stable-stringify'),
safeRegex = require('safe-regex'),
jsonpath = require('./jsonpath.js'),
Function predicateSatisfied
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function predicateSatisfied (expected, actual, predicateConfig, predicateFn) {
if (!actual) {
return false;
}
Function selectTransform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
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 selectJSONPath
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function selectJSONPath (config, encoding, predicateConfig, stringTransform, logger, text) {
Function and
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function and (predicate, request, encoding, logger, imposterState) {
Function not
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function not (predicate, request, encoding, logger, imposterState) {
Function inject
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function inject (predicate, request, encoding, logger, imposterState) {
Function or
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function or (predicate, request, encoding, logger, imposterState) {
Function evaluate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function evaluate (predicate, request, encoding, logger, imposterState) {
Avoid too many return
statements within this function. Open
Open
return predicateSatisfied(expected[fieldName], actual[fieldName], predicateConfig, predicateFn);
Avoid too many return
statements within this function. Open
Open
return value;
Avoid too many return
statements within this function. Open
Open
return testPredicate(expected[fieldName], actual[fieldName], predicateConfig, predicateFn);
Parsing error: Invalid ecmaVersion. Open
Open
'use strict';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/