Showing 12 of 29 total issues
File scenarios.js
has 521 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
// @flow
import _ from 'lodash';
import functionArguments from 'function-arguments';
import humanize from 'string-humanize';
import stripAnsi from 'strip-ansi';
Function scenarios
has 201 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
scenarios<G: Stage, W: Stage, T: Stage>(
groupName: string,
stagesParams: StagesParam<G, W, T>,
scenariosDescriptions: ScenariosDescriptions<G, W, T>
) {
Function buildStage
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
buildStage<T>(tClass: Class<T>, runningScenario: RunningScenario): T {
// $FlowIgnore
const tInstance = new tClass();
const tPrototype = Object.getPrototypeOf(tInstance);
Function methodName
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
proxyPrototype[methodName] = function(...args: any[]): any {
const {
state,
steps,
caseArguments,
Function constructor
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
constructor(
methodName: string,
parameters: DecodedParameter[],
isFirstStep: boolean,
introWord: string | null,
Function buildParameterFormatter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
export function buildParameterFormatter(
formatter: Formatter
): ParameterFormatter {
const parameterFormatter = function(
...parameterNames: string[]
Function aroundToBeforeAfter
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function aroundToBeforeAfter(
aroundMethod: AroundMethod
): BeforeAfterMethods {
let currentlyExecuting: 'NONE' | 'BEFORE' | 'TEST' | 'AFTER' = 'NONE';
let promiseOfAroundMethod;
Function getScenarios
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
function getScenarios(scenarios: {
[key: string]: ScenarioDescription,
}): ScenarioDescriptionWithName[] {
const scenarioDescriptions: ScenarioDescriptionWithName[] = Object.keys(
scenarios
Function scenarios
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Confirmed
scenarios<G: Stage, W: Stage, T: Stage>(
groupName: string,
stagesParams: StagesParam<G, W, T>,
scenariosDescriptions: ScenariosDescriptions<G, W, T>
) {
- 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 scenarioDescriptions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
).map(scenarioPropertyName => {
const scenarioDescription: ScenarioDescription =
scenarios[scenarioPropertyName];
const { scenarioFunction } = scenarioDescription;
if (scenarioFunction instanceof Function) {
Function constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Confirmed
constructor(
methodName: string,
parameters: DecodedParameter[],
isFirstStep: boolean,
introWord: string | null,
- 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 aroundToBeforeAfter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function aroundToBeforeAfter(
aroundMethod: AroundMethod
): BeforeAfterMethods {
let currentlyExecuting: 'NONE' | 'BEFORE' | 'TEST' | 'AFTER' = 'NONE';
let promiseOfAroundMethod;
- 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"