ssube/js-utils

View on GitHub

Showing 3 of 400 total issues

Function childResult has 32 lines of code (exceeds 30 allowed). Consider refactoring.
Open

export function childResult(child: ChildStreams): Promise<ChildResult> {
  return new Promise((res, rej) => {
    const stderr: Array<Buffer> = [];
    const stdout: Array<Buffer> = [];

Severity: Minor
Found in src/Child.ts - About 1 hr to fix

    Function getMethods has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
    Open

    export function getMethods<TValue extends Reflectable>(value: TValue): Set<Method<TValue>> {
      const methods = new Set<Method<TValue>>();
    
      for (const name of Object.getOwnPropertyNames(value)) {
        const desc = Object.getOwnPropertyDescriptor(value, name);
    Severity: Minor
    Found in src/Reflect.ts - About 55 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 normalizeMap has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
    Open

    export function normalizeMap(map: MapLike<unknown>): Dict<Array<string>> {
      const data: Dict<Array<string>> = {};
      for (const [key, value] of makeMap(map)) {
        // eslint-disable-next-line no-restricted-syntax
        if (Array.isArray(value)) {
    Severity: Minor
    Found in src/Map.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

    Severity
    Category
    Status
    Source
    Language