pankod/superplate

View on GitHub

Showing 13 of 42 total issues

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

    get: (
        choice: string,
    ): { title: string; description: string; value: string } => {
        switch (choice) {
            case "react":
Severity: Minor
Found in src/Helper/humanize/index.ts - About 1 hr to fix

    Function data has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        data(sao) {
            /**
             * Package Manager
             */
            const answers = {
    Severity: Minor
    Found in src/saofile.ts - About 1 hr to fix

      Function cli has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      const cli = async (): Promise<void> => {
          clear();
          const program = commander
              .name(packageData.name)
              .version(packageData.version)
      Severity: Minor
      Found in src/cli.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 get_potential_package_managers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const get_potential_package_managers = (): Array<{
          message: string;
          name: string;
      }> => {
          const pmQuestionChoises = [
      Severity: Minor
      Found in src/Helper/npm/index.ts - About 1 hr to fix

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

        export const prompt_project_types = async (
            source: string,
            types: any[],
            typeFromArgs?: string,
        ): Promise<[projectTypePath: string, projectType: string]> => {
        Severity: Minor
        Found in src/Helper/source/index.ts - About 1 hr to fix

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

              async actions(sao) {
                  const answers = {
                      ...sao.opts.extras.presetAnswers,
                      ...sao.answers,
                  };
          Severity: Minor
          Found in src/saofile.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 { error: "Could not retrieve source repository." };
          Severity: Major
          Found in src/Helper/source/index.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return { path: cloneResponse };
            Severity: Major
            Found in src/Helper/source/index.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return { error: "Could not retrieve source repository." };
              Severity: Major
              Found in src/Helper/source/index.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return { error: repoStatus.error };
                Severity: Major
                Found in src/Helper/source/index.ts - About 30 mins to fix

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

                  const postInstall: PostInstallFn = ({ name, dir, pm }) => {
                      console.log("");
                  
                      console.log(
                          `${chalk.green.bold("Success!")} Created ${chalk.greenBright.bold(
                  Severity: Minor
                  Found in src/Helper/tips/index.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 completed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      async completed(saoInstance) {
                          const { debug, apiMode } = saoInstance.opts.extras;
                  
                          /**
                           * Format generated project
                  Severity: Minor
                  Found in src/saofile.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 prompt_project_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const prompt_project_types = async (
                      source: string,
                      types: any[],
                      typeFromArgs?: string,
                  ): Promise<[projectTypePath: string, projectType: string]> => {
                  Severity: Minor
                  Found in src/Helper/source/index.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