webpack/webpack

View on GitHub

Showing 1,382 of 1,382 total issues

Function jsonToString has a Cognitive Complexity of 480 (exceeds 5 allowed). Consider refactoring.
Open

    static jsonToString(obj, useColors) {
        const buf = [];

        const defaultColors = {
            bold: "\u001b[1m",
Severity: Minor
Found in lib/Stats.js - About 1 wk 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 exports has a Cognitive Complexity of 416 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function() {
    var hotApplyOnUpdate = true;
    // eslint-disable-next-line no-unused-vars
    var hotCurrentHash = $hash$;
    var hotRequestTimeout = $requestTimeout$;
Severity: Minor
Found in lib/HotModuleReplacement.runtime.js - About 1 wk 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 toJson has a Cognitive Complexity of 330 (exceeds 5 allowed). Consider refactoring.
Open

    toJson(options, forToString) {
        if (typeof options === "boolean" || typeof options === "string") {
            options = Stats.presetToOptions(options);
        } else if (!options) {
            options = {};
Severity: Minor
Found in lib/Stats.js - About 6 days 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

File Parser.js has 2216 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
    MIT License http://www.opensource.org/licenses/mit-license.php
    Author Tobias Koppers @sokra
*/
"use strict";
Severity: Major
Found in lib/Parser.js - About 6 days to fix

    Function visitModules has a Cognitive Complexity of 274 (exceeds 5 allowed). Consider refactoring.
    Open

    const visitModules = (
        compilation,
        inputChunkGroups,
        chunkGroupInfoMap,
        chunkDependencies,
    Severity: Minor
    Found in lib/buildChunkGraph.js - About 5 days 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

    File Compilation.js has 1615 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
        MIT License http://www.opensource.org/licenses/mit-license.php
        Author Tobias Koppers @sokra
        */
    "use strict";
    Severity: Major
    Found in lib/Compilation.js - About 4 days to fix

      File Stats.js has 1586 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
          MIT License http://www.opensource.org/licenses/mit-license.php
          Author Tobias Koppers @sokra
      */
      "use strict";
      Severity: Major
      Found in lib/Stats.js - About 4 days to fix

        Function source has a Cognitive Complexity of 195 (exceeds 5 allowed). Consider refactoring.
        Open

            source(dependencyTemplates, runtimeTemplate) {
                const requestShortener = runtimeTemplate.requestShortener;
                // Metainfo for each module
                const modulesWithInfo = this._orderedConcatenationList.map((info, idx) => {
                    switch (info.type) {
        Severity: Minor
        Found in lib/optimize/ConcatenatedModule.js - About 3 days 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 toJson has 708 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            toJson(options, forToString) {
                if (typeof options === "boolean" || typeof options === "string") {
                    options = Stats.presetToOptions(options);
                } else if (!options) {
                    options = {};
        Severity: Major
        Found in lib/Stats.js - About 3 days to fix

          File ConcatenatedModule.js has 1326 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
              MIT License http://www.opensource.org/licenses/mit-license.php
              Author Tobias Koppers @sokra
          */
          "use strict";
          Severity: Major
          Found in lib/optimize/ConcatenatedModule.js - About 3 days to fix

            Function jsonToString has 692 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static jsonToString(obj, useColors) {
                    const buf = [];
            
                    const defaultColors = {
                        bold: "\u001b[1m",
            Severity: Major
            Found in lib/Stats.js - About 3 days to fix

              Function initializeEvaluating has 623 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  initializeEvaluating() {
                      this.hooks.evaluate.for("Literal").tap("Parser", expr => {
                          switch (typeof expr.value) {
                              case "number":
                                  return new BasicEvaluatedExpression()
              Severity: Major
              Found in lib/Parser.js - About 3 days to fix

                Function source has 606 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    source(dependencyTemplates, runtimeTemplate) {
                        const requestShortener = runtimeTemplate.requestShortener;
                        // Metainfo for each module
                        const modulesWithInfo = this._orderedConcatenationList.map((info, idx) => {
                            switch (info.type) {
                Severity: Major
                Found in lib/optimize/ConcatenatedModule.js - About 3 days to fix

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

                      apply(mainTemplate) {
                          const needChunkOnDemandLoadingCode = chunk => {
                              for (const chunkGroup of chunk.groupsIterable) {
                                  if (chunkGroup.getNumberOfChildren() > 0) return true;
                              }
                  Severity: Major
                  Found in lib/web/JsonpMainTemplatePlugin.js - About 2 days to fix

                    Function exports has 563 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function() {
                        var hotApplyOnUpdate = true;
                        // eslint-disable-next-line no-unused-vars
                        var hotCurrentHash = $hash$;
                        var hotRequestTimeout = $requestTimeout$;
                    Severity: Major
                    Found in lib/HotModuleReplacement.runtime.js - About 2 days to fix

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

                                                              mainTemplate.getAssetPath(
                                                                  JSON.stringify(`/${chunkFilename}`),
                                                                  {
                                                                      hash: `" + ${mainTemplate.renderCurrentHashCode(
                                                                          hash
                      Severity: Major
                      Found in lib/node/NodeMainTemplatePlugin.js and 1 other location - About 2 days to fix
                      lib/node/NodeMainTemplatePlugin.js on lines 193..242

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

                      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 request = mainTemplate.getAssetPath(
                                              JSON.stringify(`./${chunkFilename}`),
                                              {
                                                  hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
                                                  hashWithLength: length =>
                      Severity: Major
                      Found in lib/node/NodeMainTemplatePlugin.js and 1 other location - About 2 days to fix
                      lib/node/NodeMainTemplatePlugin.js on lines 100..157

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

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

                          apply(compiler) {
                              compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => {
                                  let alreadyOptimized = false;
                                  compilation.hooks.unseal.tap("SplitChunksPlugin", () => {
                                      alreadyOptimized = false;
                      Severity: Major
                      Found in lib/optimize/SplitChunksPlugin.js - About 2 days to fix

                        Function process has 460 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            process(options, compiler) {
                                let ExternalsPlugin;
                                compiler.outputPath = options.output.path;
                                compiler.recordsInputPath = options.recordsInputPath || options.recordsPath;
                                compiler.recordsOutputPath =
                        Severity: Major
                        Found in lib/WebpackOptionsApply.js - About 2 days to fix

                          Parser has 108 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Parser extends Tapable {
                              constructor(options, sourceType = "auto") {
                                  super();
                                  this.hooks = {
                                      evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])),
                          Severity: Major
                          Found in lib/Parser.js - About 2 days to fix
                            Severity
                            Category
                            Status
                            Source
                            Language