wesm87/wp-project-manager

View on GitHub

Showing 12 of 29 total issues

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

    File project.ts has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Project config settings and helper methods.
     */
    
    import path from 'path';
    Severity: Minor
    Found in src/include/project.ts - About 3 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 createLogWithStyle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const createLogWithStyle = (style: string) => async (message: any) => {
              const config = await getConfig();
            
              // Bail if the style is 'debug' and debugging is disabled.
              if (style === 'debug' && !config.debug) {
            Severity: Minor
            Found in src/include/log.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 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

            Avoid too many return statements within this function.
            Open

                return false;
            Severity: Major
            Found in src/include/utils/fs.ts - About 30 mins to fix

              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 loadConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const loadConfig = async (file: string = ''): Promise<ProjectConfig> => {
                let config;
              
                const paths = getPaths();
              
              
              Severity: Minor
              Found in src/include/project.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

              Severity
              Category
              Status
              Source
              Language