webpack/webpack-cli

View on GitHub

Showing 79 of 79 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const runTest = (pkg, cliArgs = [], logMessage, isSubPackage = false) => {
  // Simulate package missing
  swapPkgName(pkg, isSubPackage);

  const proc = execa(CLI_ENTRY_PATH, cliArgs, {
Severity: Major
Found in smoketests/helpers.js and 1 other location - About 2 days to fix
smoketests/helpers.js on lines 192..249

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 421.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const runTestWithHelp = (pkg, cliArgs = [], logMessage, isSubPackage = false) => {
  // Simulate package missing
  swapPkgName(pkg, isSubPackage);

  const proc = execa(CLI_ENTRY_PATH, cliArgs, {
Severity: Major
Found in smoketests/helpers.js and 1 other location - About 2 days to fix
smoketests/helpers.js on lines 27..83

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 421.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    prompts: [
      {
        type: "list",
        name: "langType",
        message: "Which of the following JS solutions do you want to use?",
Severity: Major
Found in packages/create-webpack-app/src/generators/init/react.ts and 1 other location - About 2 days to fix
packages/create-webpack-app/src/generators/init/vue.ts on lines 29..100

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 384.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    prompts: [
      {
        type: "list",
        name: "langType",
        message: "Which of the following JS solutions do you want to use?",
Severity: Major
Found in packages/create-webpack-app/src/generators/init/vue.ts and 1 other location - About 2 days to fix
packages/create-webpack-app/src/generators/init/react.ts on lines 31..102

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 384.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    await cli.makeCommand(
      {
        name: "loader [output-path]",
        alias: "l",
        description: "Scaffold a loader.",
Severity: Major
Found in packages/generators/src/index.ts and 1 other location - About 1 day to fix
packages/generators/src/index.ts on lines 103..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 265.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    await cli.makeCommand(
      {
        name: "plugin [output-path]",
        alias: "p",
        description: "Scaffold a plugin.",
Severity: Major
Found in packages/generators/src/index.ts and 1 other location - About 1 day to fix
packages/generators/src/index.ts on lines 63..101

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 265.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function default has 205 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default async function (plop: NodePlopAPI) {
  // dependencies to be installed
  const devDependencies: Array<string> = [
    "webpack",
    "webpack-cli",
Severity: Major
Found in packages/create-webpack-app/src/generators/init/vue.ts - About 1 day to fix

    Function default has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default async function (plop: NodePlopAPI) {
      // dependencies to be installed
      const devDependencies: Array<string> = [
        "webpack",
        "webpack-cli",
    Severity: Major
    Found in packages/create-webpack-app/src/generators/init/react.ts - About 1 day to fix

      Function default has 185 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default async function (plop: NodePlopAPI) {
        // dependencies to be installed
        const devDependencies: Array<string> = [
          "webpack",
          "webpack-cli",
      Severity: Major
      Found in packages/create-webpack-app/src/generators/init/svelte.ts - About 7 hrs to fix

        Function default has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default async function (plop: NodePlopAPI) {
          // dependencies to be installed
          const devDependencies: Array<string> = ["webpack", "webpack-cli"];
        
          await plop.load("../../utils/pkgInstallAction.js", {}, true);
        Severity: Major
        Found in packages/create-webpack-app/src/generators/init/default.ts - About 7 hrs to fix

          Function default has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          export default async function (plop: NodePlopAPI) {
            // dependencies to be installed
            const devDependencies: Array<string> = [
              "webpack",
              "webpack-cli",
          Severity: Minor
          Found in packages/create-webpack-app/src/generators/init/vue.ts - About 5 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                const files: Array<FileRecord> = [
                  { filePath: "./index.html", fileType: "text" },
                  { filePath: "./src/assets/webpack.png", fileType: "binary" },
                  { filePath: "webpack.config.js", fileType: "text" },
                  { filePath: "package.json", fileType: "text" },
          Severity: Major
          Found in packages/create-webpack-app/src/generators/init/vue.ts and 1 other location - About 5 hrs to fix
          packages/create-webpack-app/src/generators/plugin/default.ts on lines 56..67

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 140.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                const files: Array<FileRecord> = [
                  { filePath: "./package.json", fileType: "text" },
                  { filePath: "./examples/simple/src/index.js", fileType: "text" },
                  { filePath: "./examples/simple/src/lazy-module.js", fileType: "text" },
                  { filePath: "./examples/simple/src/static-esm-module.js", fileType: "text" },
          Severity: Major
          Found in packages/create-webpack-app/src/generators/plugin/default.ts and 1 other location - About 5 hrs to fix
          packages/create-webpack-app/src/generators/init/vue.ts on lines 154..165

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 140.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                if (answers.cssType === "none") {
                  answers.isCSS = false;
                  answers.isPostCSS = false;
                  answers.extractPlugin = "No";
                } else {
          Severity: Major
          Found in packages/create-webpack-app/src/generators/init/svelte.ts and 1 other location - About 5 hrs to fix
          packages/create-webpack-app/src/generators/init/react.ts on lines 124..144

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 139.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                if (answers.cssType === "none") {
                  answers.isCSS = false;
                  answers.isPostCSS = false;
                  answers.extractPlugin = "No";
                } else {
          Severity: Major
          Found in packages/create-webpack-app/src/generators/init/react.ts and 1 other location - About 5 hrs to fix
          packages/create-webpack-app/src/generators/init/svelte.ts on lines 117..137

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 139.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function apply has 123 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async apply(cli: IWebpackCLI): Promise<void> {
              await cli.makeCommand(
                {
                  name: "init [generation-path]",
                  alias: ["create", "new", "c", "n"],
          Severity: Major
          Found in packages/generators/src/index.ts - About 4 hrs to fix

            Function actions has 114 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                actions: function (answers: Answers) {
                  // setting some default values based on the answers
                  const actions: ActionType[] = [];
                  answers.htmlWebpackPlugin = true;
                  answers.devServer = true;
            Severity: Major
            Found in packages/create-webpack-app/src/generators/init/vue.ts - About 4 hrs to fix

              Function actions has 112 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  actions: function (answers: Answers) {
                    // setting some default values based on the answers
                    const actions: ActionType[] = [];
                    answers.htmlWebpackPlugin = true;
                    answers.devServer = true;
              Severity: Major
              Found in packages/create-webpack-app/src/generators/init/react.ts - About 4 hrs to fix

                Function checkAndPrepareContent has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                async function checkAndPrepareContent(config: AddConfig, isTemplate: boolean): Promise<Result> {
                  const fileExists = await doesFileExists(config.path);
                  let existingFileContent: Content = "";
                  let newContent: Content = "";
                
                
                Severity: Minor
                Found in packages/create-webpack-app/src/utils/fileGenerator.ts - About 4 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 default has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                export default async function (plop: NodePlopAPI) {
                  // dependencies to be installed
                  const devDependencies: Array<string> = ["webpack", "webpack-cli"];
                
                  await plop.load("../../utils/pkgInstallAction.js", {}, true);
                Severity: Minor
                Found in packages/create-webpack-app/src/generators/init/default.ts - About 4 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

                Severity
                Category
                Status
                Source
                Language