Showing 37 of 37 total issues
File matchers.spec.ts
has 761 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { expect } from 'chai';
import {
boolean,
decimal,
eachLike,
File matchers.spec.ts
has 660 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as chai from 'chai';
import * as MatchersV3 from './matchers';
const { expect } = chai;
File matchers.ts
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { isNil, pickBy, times } from 'ramda';
import RandExp from 'randexp';
import {
ArrayContainsMatcher,
File index.ts
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable */
import { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core';
import { JsonMap } from '../../common/jsonTypes';
import { forEachObjIndexed } from 'ramda';
import { Path, TemplateHeaders, TemplateQuery, V3MockServer } from '../../v3';
File index.ts
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable */
import { Metadata } from '../../dsl/message';
import { AnyJson, JsonMap } from '../../common/jsonTypes';
import {
PluginConfig,
Function traceHttpInteractions
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const traceHttpInteractions = (): void => {
const originalRequest = http.request;
http.request = (
options: RequestOptions | string | URL,
cb: RequestOptions | ((res: IncomingMessage) => void) | undefined
Function request
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
http.request = (
options: RequestOptions | string | URL,
cb: RequestOptions | ((res: IncomingMessage) => void) | undefined
): ClientRequest => {
if (typeof options === 'string' || options instanceof URL) {
Function url2
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function url2(
basePath: string | null,
pathFragments: Array<string | V3RegexMatcher | RegExp>
): V3RegexMatcher {
const regexpr = [
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(config: VerifierOptions) {
this.config = config;
if (this.config.logLevel && !isEmpty(this.config.logLevel)) {
serviceFactory.logLevel(this.config.logLevel);
Function url2
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export function url2(
basePath: string | null,
pathFragments: Array<string | V3RegexMatcher | RegExp>
): V3RegexMatcher {
const regexpr = [
- 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 executeTest
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async executeTest<T>(
testFn: (mockServer: V3MockServer) => Promise<T>
): Promise<T | undefined> {
const scheme = this.opts.tls ? 'https' : 'http';
const host = this.opts.host || '127.0.0.1';
Function setHeaders
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const setHeaders = (
part: InteractionPart,
interaction: ConsumerInteraction,
headers?: Headers
): void => {
Function createProxy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const createProxy = (
config: ProxyOptions,
stateSetupPath: string,
messageTransportPath: string
): http.Server => {
Function generateMockServerError
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function generateMockServerError(
mismatches: MatchingResult[],
indent: string
): string {
return [
Function verifyProvider
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public verifyProvider(): Promise<string> {
logger.info('Verifying provider');
if (isEmpty(this.config)) {
return Promise.reject(
Function executeTest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const executeTest = async <T>(
pact: ConsumerPact,
opts: PactV4Options,
testFn: TestFunction<T>,
cleanupFn: () => void
Function executeTest
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async executeTest<T>(
integrationTest: (tc: TransportConfig, m: SynchronousMessage) => Promise<T>
): Promise<T | undefined> {
let val: T | undefined;
let error: Error | undefined;
Function setupStates
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const setupStates = (
state: ProviderState,
config: ProxyOptions
): Promise<JsonMap | void> => {
logger.debug(`setting up state '${JSON.stringify(state)}'`);
Function reify
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reify(input: unknown): AnyJson {
if (isMatcher(input)) {
return reify(input.value);
}
Function setRequestDetails
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const setRequestDetails = (
interaction: ConsumerInteraction,
req: V3Request
): void => {
interaction.withRequest(