Griffingj/voila-di

View on GitHub

Showing 9 of 9 total issues

Function containerFactory has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function containerFactory(
  graph: StrictGraph = {},
  libOptions?: Partial<Options>,
  graphLookup?: GraphLookup): Container {

Severity: Major
Found in src/lib/containerFactory.ts - About 4 hrs to fix

    Function resolveDependencies has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    const resolveDependencies: ResolveDependencies = (
      rootKey,
      rootDeclaration,
      declarationLookup,
      handleCircular,
    Severity: Minor
    Found in src/lib/resolveDependencies.ts - About 3 hrs 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 containerFactory has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function containerFactory(
      graph: StrictGraph = {},
      libOptions?: Partial<Options>,
      graphLookup?: GraphLookup): Container {
    
    
    Severity: Minor
    Found in src/lib/containerFactory.ts - About 3 hrs 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 resolveDependencies has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const resolveDependencies: ResolveDependencies = (
      rootKey,
      rootDeclaration,
      declarationLookup,
      handleCircular,
    Severity: Major
    Found in src/lib/resolveDependencies.ts - About 3 hrs to fix

      Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          get(requestedKey) {
            // If the key cannot be found in the graph, fail
            const maybeDeclaration = graph[requestedKey];
      
            if (!maybeDeclaration) {
      Severity: Minor
      Found in src/lib/containerFactory.ts - About 1 hr to fix

        Function makeSinglyLinkedList has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function makeSinglyLinkedList<T>(initialValues?: T[]) {
          let head: SinglyLinkedListNode<T> | null = null;
          let size: number = 0;
        
          const singlyLinkedList: SinglyLinkedList<T> = {
        Severity: Minor
        Found in src/lib/singlyLinkedList.ts - About 1 hr to fix

          Function makeSinglyLinkedList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function makeSinglyLinkedList<T>(initialValues?: T[]) {
            let head: SinglyLinkedListNode<T> | null = null;
            let size: number = 0;
          
            const singlyLinkedList: SinglyLinkedList<T> = {
          Severity: Minor
          Found in src/lib/singlyLinkedList.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

          Avoid deeply nested control flow statements.
          Open

                    if (!handleCircular) {
                      return {
                        kind: 'CircularDependencyFailure',
                        message: `"${key}" has circular dependency "${childkey}"`,
                        value: { history }
          Severity: Major
          Found in src/lib/resolveDependencies.ts - About 45 mins to fix

            Function ensureStrictGraph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function ensureStrictGraph(graph: StringIndexable): StrictGraph {
              const strictGraph: StrictGraph = {};
              const keys = Object.keys(graph);
            
              for (const key of keys) {
            Severity: Minor
            Found in src/lib/ensureStrictGraph.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

            Severity
            Category
            Status
            Source
            Language