webpack/webpack-cli

View on GitHub

Showing 29 of 29 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 194..251

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 29..85

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

    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 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 addonGenerator has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const addonGenerator = <
      T extends BaseCustomGeneratorOptions = BaseCustomGeneratorOptions,
      Z extends CustomGeneratorOptions<T> = CustomGeneratorOptions<T>,
    >(
      prompts: Generator.Questions,
    Severity: Major
    Found in packages/generators/src/addon-generator.ts - About 2 hrs to fix

      Function questions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function questions(
        self: CustomGenerator,
        Question: typeof QuestionAPI,
        config: Record<string, { skip?: boolean; required?: boolean }> = {
          langType: {},
      Severity: Minor
      Found in packages/generators/src/handlers/default.ts - About 2 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 generate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function generate(self: CustomGenerator): void {
        // eslint-disable-next-line @typescript-eslint/no-var-requires
        const destPkgJson = require(resolveFile("package.json.js"))(self.answers.devServer);
        const sourcePkgJsonPath = self.destinationPath("package.json");
      
      
      Severity: Minor
      Found in packages/generators/src/handlers/default.ts - About 1 hr to fix

        Function runTest has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const runTest = (pkg, cliArgs = [], logMessage, isSubPackage = false) => {
          // Simulate package missing
          swapPkgName(pkg, isSubPackage);
        
          const proc = execa(CLI_ENTRY_PATH, cliArgs, {
        Severity: Minor
        Found in smoketests/helpers.js - About 1 hr to fix

          Function runTestWithHelp has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const runTestWithHelp = (pkg, cliArgs = [], logMessage, isSubPackage = false) => {
            // Simulate package missing
            swapPkgName(pkg, isSubPackage);
          
            const proc = execa(CLI_ENTRY_PATH, cliArgs, {
          Severity: Minor
          Found in smoketests/helpers.js - About 1 hr to fix

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

                proc.stderr.on("data", (chunk) => {
                  const data = stripAnsi(chunk.toString());
                  console.log(`  stderr: ${data}`);
                });
            Severity: Major
            Found in smoketests/helpers.js and 1 other location - About 1 hr to fix
            smoketests/helpers.js on lines 175..178

            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 60.

            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

                proc.stderr.on("data", (chunk) => {
                  const data = stripAnsi(chunk.toString());
                  console.log(`  stderr: ${data}`);
                });
            Severity: Major
            Found in smoketests/helpers.js and 1 other location - About 1 hr to fix
            smoketests/helpers.js on lines 116..119

            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 60.

            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 writing has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public writing(): void {
                  const name = (this.props as Generator.Question).name as string;
                  const resolvedTemplatePath = this.resolvedTemplatePath as string;
                  const packageJsonTemplatePath = "../addon-template/package.json.js";
            
            
            Severity: Minor
            Found in packages/generators/src/addon-generator.ts - About 1 hr to fix

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

              const versionCommand = () => {
                const packageName = "webpack";
                const args = ["version"];
                const logMessage = "System:";
              
              
              Severity: Major
              Found in smoketests/missing-packages/webpack.test.js and 2 other locations - About 1 hr to fix
              smoketests/missing-packages/webpack.test.js on lines 45..51
              smoketests/missing-packages/webpack.test.js on lines 53..59

              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 58.

              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 3 locations. Consider refactoring.
              Open

              const helpCommand = () => {
                const packageName = "webpack";
                const args = ["help"];
                const logMessage = "The build tool for modern web applications.";
              
              
              Severity: Major
              Found in smoketests/missing-packages/webpack.test.js and 2 other locations - About 1 hr to fix
              smoketests/missing-packages/webpack.test.js on lines 37..43
              smoketests/missing-packages/webpack.test.js on lines 53..59

              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 58.

              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 3 locations. Consider refactoring.
              Open

              const infoCommand = () => {
                const packageName = "webpack";
                const args = ["info"];
                const logMessage = "System:";
              
              
              Severity: Major
              Found in smoketests/missing-packages/webpack.test.js and 2 other locations - About 1 hr to fix
              smoketests/missing-packages/webpack.test.js on lines 37..43
              smoketests/missing-packages/webpack.test.js on lines 45..51

              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 58.

              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 generate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function generate(self: CustomGenerator): void {
                const files = ["./index.html", "./src/assets/webpack.png", "webpack.config.js", "package.json"];
              
                switch (self.answers.langType) {
                  case "Typescript":
              Severity: Minor
              Found in packages/generators/src/handlers/react.ts - About 1 hr to fix

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

                  [
                    {
                      default: "my-loader",
                      filter: makeLoaderName,
                      message: "Loader name",
                Severity: Minor
                Found in packages/generators/src/loader-generator.ts and 1 other location - About 55 mins to fix
                packages/generators/src/plugin-generator.ts on lines 8..17

                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 54.

                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

                export function Confirm(
                  self: Generator,
                  name: string,
                  message: string,
                  defaultChoice = true,
                Severity: Minor
                Found in packages/generators/src/utils/scaffold-utils.ts and 1 other location - About 55 mins to fix
                packages/generators/src/utils/scaffold-utils.ts on lines 21..33

                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 54.

                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

                  [
                    {
                      default: "my-webpack-plugin",
                      filter: toKebabCase,
                      message: "Plugin name",
                Severity: Minor
                Found in packages/generators/src/plugin-generator.ts and 1 other location - About 55 mins to fix
                packages/generators/src/loader-generator.ts on lines 26..35

                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 54.

                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

                Severity
                Category
                Status
                Source
                Language