wesm87/wp-project-manager

View on GitHub
src/include/scaffold.ts

Summary

Maintainability
C
1 day
Test Coverage

File scaffold.ts has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @module
 */

import path from 'path';
Severity: Minor
Found in src/include/scaffold.ts - About 5 hrs to fix

    Function linkFiles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      static async linkFiles(type: string = 'project') {
        const base = await this.getBasePath(type);
        const files = pathOr<any[]>([], [type, 'link'], FILES);
    
        if (isEmpty(files)) {
    Severity: Minor
    Found in src/include/scaffold.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 createPlaceholders has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async createPlaceholders(type: string = 'theme'): Promise<void> {
        const base = await this.getBasePath(type);
    
        const dirs = [
          'includes',
    Severity: Minor
    Found in src/include/scaffold.ts - About 1 hr to fix

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

        static async initTheme(): Promise<boolean> {
          const config = await getConfig();
      
          if (!config.theme.scaffold) {
            return false;
      Severity: Minor
      Found in src/include/scaffold.ts - About 1 hr to fix

        Function scaffoldFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static async scaffoldFile(
            source: string,
            type: string = 'project',
          ): Promise<boolean> {
            let file = path.basename(source, '.mustache');
        Severity: Minor
        Found in src/include/scaffold.ts - About 1 hr to fix

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

            static async removeFiles(type: string = 'project') {
              const base = await this.getBasePath(type);
              const files = FILES[type].remove;
          
              if (!files) {
          Severity: Minor
          Found in src/include/scaffold.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 initRepo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            static async initRepo(): Promise<boolean> {
              const paths = getPaths();
              const config = await getConfig();
          
              if (!config.repo.create) {
          Severity: Minor
          Found in src/include/scaffold.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

          Function createPlaceholders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            static async createPlaceholders(type: string = 'theme'): Promise<void> {
              const base = await this.getBasePath(type);
          
              const dirs = [
                'includes',
          Severity: Minor
          Found in src/include/scaffold.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