webpack/webpack

View on GitHub

Showing 1,932 of 1,932 total issues

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

const visitModules = (
    logger,
    compilation,
    inputEntrypoints,
    chunkGroupInfoMap,
Severity: Minor
Found in lib/buildChunkGraph.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

File JavascriptParser.js has 2646 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
    MIT License http://www.opensource.org/licenses/mit-license.php
    Author Tobias Koppers @sokra
*/

Severity: Major
Found in lib/javascript/JavascriptParser.js - About 1 wk to fix

    Function createSnapshot has a Cognitive Complexity of 330 (exceeds 5 allowed). Consider refactoring.
    Open

        createSnapshot(startTime, files, directories, missing, options, callback) {
            /** @type {Map<string, FileSystemInfoEntry>} */
            const fileTimestamps = new Map();
            /** @type {Map<string, string>} */
            const fileHashes = new Map();
    Severity: Minor
    Found in lib/FileSystemInfo.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

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

    class StackedMap {
        /**
         * @param {Map<K, InternalCell<V>>[]=} parentStack an optional parent
         */
        constructor(parentStack) {
    Severity: Major
    Found in lib/util/StackedSetMap.js and 1 other location - About 5 days to fix
    lib/util/StackedMap.js on lines 41..164

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

    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

    class StackedMap {
        /**
         * @param {Map<K, InternalCell<V>>[]=} parentStack an optional parent
         */
        constructor(parentStack) {
    Severity: Major
    Found in lib/util/StackedMap.js and 1 other location - About 5 days to fix
    lib/util/StackedSetMap.js on lines 41..164

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

    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

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

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

      Function exports has a Cognitive Complexity of 257 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function() {
          function getAffectedModuleEffects(updateModuleId) {
              var outdatedModules = [updateModuleId];
              var outdatedDependencies = {};
      
      
      Severity: Minor
      Found in lib/hmr/JavascriptHotModuleReplacement.runtime.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 ConcatenatedModule.js has 1430 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        File FileSystemInfo.js has 1421 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

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

              initializeEvaluating() {
                  this.hooks.evaluate.for("Literal").tap("JavascriptParser", _expr => {
                      const expr = /** @type {LiteralNode} */ (_expr);
          
                      switch (typeof expr.value) {
          Severity: Major
          Found in lib/javascript/JavascriptParser.js - About 3 days to fix

            Function codeGeneration has a Cognitive Complexity of 159 (exceeds 5 allowed). Consider refactoring.
            Open

                codeGeneration({
                    dependencyTemplates,
                    runtimeTemplate,
                    moduleGraph,
                    chunkGraph
            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 apply has 629 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                apply(compiler) {
                    const cachedContextify = contextify.bindContextCache(
                        compiler.context,
                        compiler.root
                    );
            Severity: Major
            Found in lib/optimize/SplitChunksPlugin.js - About 3 days to fix

              Function _checkSnapshotValidNoCache has a Cognitive Complexity of 150 (exceeds 5 allowed). Consider refactoring.
              Open

                  _checkSnapshotValidNoCache(snapshot, callback) {
                      let callbacks;
                      const {
                          startTime,
                          fileTimestamps,
              Severity: Minor
              Found in lib/FileSystemInfo.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

              File DefaultStatsFactoryPlugin.js has 1156 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
                  MIT License http://www.opensource.org/licenses/mit-license.php
                  Author Tobias Koppers @sokra
              */
              
              
              Severity: Major
              Found in lib/stats/DefaultStatsFactoryPlugin.js - About 2 days to fix

                File DefaultStatsPrinterPlugin.js has 1073 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                    MIT License http://www.opensource.org/licenses/mit-license.php
                    Author Tobias Koppers @sokra
                */
                
                
                Severity: Major
                Found in lib/stats/DefaultStatsPrinterPlugin.js - About 2 days to fix

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

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

                    SIMPLE_PRINTERS has 134 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    const SIMPLE_PRINTERS = {
                        "compilation.hash": (hash, { bold, type }) =>
                            type === "compilation.hash" ? `Hash: ${bold(hash)}` : undefined,
                        "compilation.version": (version, { bold, type }) =>
                            type === "compilation.version"
                    Severity: Major
                    Found in lib/stats/DefaultStatsPrinterPlugin.js - About 2 days to fix

                      JavascriptParser has 126 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class JavascriptParser extends Parser {
                          /**
                           * @param {TODO} options options
                           * @param {"module" | "script" | "auto"} sourceType default source type
                           */
                      Severity: Major
                      Found in lib/javascript/JavascriptParser.js - About 2 days to fix

                        Function visitModules has 489 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const visitModules = (
                            logger,
                            compilation,
                            inputEntrypoints,
                            chunkGroupInfoMap,
                        Severity: Major
                        Found in lib/buildChunkGraph.js - About 2 days to fix

                          File ModuleGraph.js has 917 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*
                              MIT License http://www.opensource.org/licenses/mit-license.php
                              Author Tobias Koppers @sokra
                          */
                          
                          
                          Severity: Major
                          Found in lib/ModuleGraph.js - About 2 days to fix
                            Severity
                            Category
                            Status
                            Source
                            Language