pact-foundation/pact-js

View on GitHub
src/v4/message/index.ts

Summary

Maintainability
B
6 hrs
Test Coverage

File index.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable */
import { Metadata } from '../../dsl/message';
import { AnyJson, JsonMap } from '../../common/jsonTypes';
import {
  PluginConfig,
Severity: Minor
Found in src/v4/message/index.ts - About 4 hrs to fix

    Function executeTest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async executeTest<T>(
        integrationTest: (tc: TransportConfig, m: SynchronousMessage) => Promise<T>
      ): Promise<T | undefined> {
        let val: T | undefined;
        let error: Error | undefined;
    Severity: Minor
    Found in src/v4/message/index.ts - About 1 hr to fix

      Function cleanup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const cleanup = (
        success: boolean,
        pact: ConsumerPact,
        opts: PactV4Options,
        cleanupFn: () => void,
      Severity: Minor
      Found in src/v4/message/index.ts - About 45 mins to fix

      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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        async executeTest<T>(
          integrationTest: (tc: TransportConfig, m: SynchronousMessage) => Promise<T>
        ): Promise<T | undefined> {
          let val: T | undefined;
          let error: Error | undefined;
      Severity: Minor
      Found in src/v4/message/index.ts - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status