ssube/noicejs

View on GitHub

Showing 4 of 6 total issues

File TestInject.ts has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { expect } from 'chai';
import { spy, stub } from 'sinon';

import { NullLogger, Provides } from '../../src';
import { BaseOptions, Container, Contract } from '../../src/Container';
Severity: Minor
Found in test/container/TestInject.ts - About 2 hrs to fix

    Function getInject has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring.
    Open

    export function getInject(target: any): Array<Dependency> {
      if (Reflect.has(target, injectionSymbol)) {
        const existing = Reflect.get(target, injectionSymbol);
        if (Array.isArray(existing)) {
          return existing;
    Severity: Minor
    Found in src/Inject.ts - About 35 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 create has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
    Open

      public async create<TReturn, TOptions extends BaseOptions>(
        contract: Contract<TReturn, TOptions>,
        options: PartialOptions<TOptions> = {},
        ...args: ExtraArgs
      ): Promise<TReturn> {
    Severity: Minor
    Found in src/Container.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

    TODO found
    Open

        // TODO: this shouldn't need any, but TInner is not sufficiently provable and causes a TS error
    Severity: Minor
    Found in src/Container.ts by fixme
    Severity
    Category
    Status
    Source
    Language