webpack/webpack

View on GitHub

Showing 923 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

                      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

                            Function process has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                            Open

                                process(options, compiler) {
                                    let ExternalsPlugin;
                                    compiler.outputPath = options.output.path;
                                    compiler.recordsInputPath = options.recordsInputPath || options.recordsPath;
                                    compiler.recordsOutputPath =
                            Severity: Minor
                            Found in lib/WebpackOptionsApply.js - About 2 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 exports has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
                            Open

                            module.exports = ({ level = "info", debug = false, console }) => {
                                const debugFilters =
                                    typeof debug === "boolean"
                                        ? [() => debug]
                                        : /** @type {FilterItemTypes[]} */ ([])
                            Severity: Minor
                            Found in lib/logging/createConsoleLogger.js - About 1 day 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