VoxaAI/voxa-cli

View on GitHub
src/Schema.ts

Summary

Maintainability
C
1 day
Test Coverage

File Schema.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2018 Rain Agency <contact@rain.agency>
 * Author: Rain Agency <contact@rain.agency>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
Severity: Minor
Found in src/Schema.ts - About 3 hrs to fix

    Function buildViewsMapping has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public buildViewsMapping(): void {
        function pathsFinder(object: any, prefixes: string[] = []) {
          let paths: string[] = [];
          let value: any;
          if (typeof object === "object") {
    Severity: Major
    Found in src/Schema.ts - About 3 hrs to fix

      Function buildViewsMapping has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        public buildViewsMapping(): void {
          function pathsFinder(object: any, prefixes: string[] = []) {
            let paths: string[] = [];
            let value: any;
            if (typeof object === "object") {
      Severity: Minor
      Found in src/Schema.ts - About 1 hr 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 mergeManifest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public mergeManifest(environment: string): any {
          const manifest = {};
          const NAMESPACE = this.NAMESPACE;
          this.publishing
            .filter(item => _.isEmpty(item.environments) && item.key.includes(this.NAMESPACE))
      Severity: Minor
      Found in src/Schema.ts - About 1 hr to fix

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

          public mergeManifest(environment: string): any {
            const manifest = {};
            const NAMESPACE = this.NAMESPACE;
            this.publishing
              .filter(item => _.isEmpty(item.environments) && item.key.includes(this.NAMESPACE))
        Severity: Minor
        Found in src/Schema.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

        There are no issues that match your filters.

        Category
        Status