meteor/meteor

View on GitHub
tools/isobuild/linker.js

Summary

Maintainability
F
4 days
Test Coverage

File linker.js has 746 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var _ = require('underscore');
var sourcemap = require('source-map');
var buildmessage = require('../utils/buildmessage.js');
var watch = require('../fs/watch');
var Profile = require('../tool-env/profile').Profile;
Severity: Major
Found in tools/isobuild/linker.js - About 1 day to fix

    Function getPrelinkedFiles has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getPrelinkedFiles: Profile("linker Module#getPrelinkedFiles", function () {
        var self = this;
    
        const haveMeteorInstallOptions =
          self.files.some(file => file.meteorInstallOptions);
    Severity: Major
    Found in tools/isobuild/linker.js - About 3 hrs to fix

      Function getPrelinkedOutputCached has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        function (file, options) {
          var width = options.sourceWidth || 70;
          var bannerWidth = width + 3;
          var preserveLineNumbers = options.preserveLineNumbers;
      
      
      Severity: Minor
      Found in tools/isobuild/linker.js - 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 getPrelinkedOutputCached has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function (file, options) {
          var width = options.sourceWidth || 70;
          var bannerWidth = width + 3;
          var preserveLineNumbers = options.preserveLineNumbers;
      
      
      Severity: Major
      Found in tools/isobuild/linker.js - About 2 hrs to fix

        Function _buildModuleTrees has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _buildModuleTrees(results, sourceWidth) {
            // Map from meteorInstallOptions objects to trees of File objects for
            // all non-dynamic modules.
            const trees = new Map;
        
        
        Severity: Major
        Found in tools/isobuild/linker.js - About 2 hrs to fix

          Function _chunkifyModuleTrees has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _chunkifyModuleTrees(trees, chunks, sourceWidth) {
              const self = this;
          
              assert.ok(_.isArray(chunks));
              assert.ok(_.isNumber(sourceWidth));
          Severity: Minor
          Found in tools/isobuild/linker.js - About 1 hr to fix

            Function computeAssignedVariables has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              computeAssignedVariables: Profile("linker File#computeAssignedVariables", function () {
                var self = this;
            
                if (self.absModuleId) {
                  const parts = self.absModuleId.split("/");
            Severity: Minor
            Found in tools/isobuild/linker.js - About 1 hr to fix

              Function computeAssignedVariables has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                computeAssignedVariables: Profile("linker File#computeAssignedVariables", function () {
                  var self = this;
              
                  if (self.absModuleId) {
                    const parts = self.absModuleId.split("/");
              Severity: Minor
              Found in tools/isobuild/linker.js - About 1 hr 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 _chunkifyEagerRequires has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _chunkifyEagerRequires(chunks, moduleCount, sourceWidth) {
                  assert.ok(_.isArray(chunks));
                  assert.ok(_.isNumber(moduleCount));
                  assert.ok(_.isNumber(sourceWidth));
              
              
              Severity: Minor
              Found in tools/isobuild/linker.js - About 1 hr to fix

                Function walk has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function walk(t) {
                      if (Array.isArray(t)) {
                        ++moduleCount;
                        chunks.push(JSON.stringify(t, null, 2));
                
                
                Severity: Minor
                Found in tools/isobuild/linker.js - About 1 hr to fix

                  Function _chunkifyModuleTrees has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _chunkifyModuleTrees(trees, chunks, sourceWidth) {
                      const self = this;
                  
                      assert.ok(_.isArray(chunks));
                      assert.ok(_.isNumber(sourceWidth));
                  Severity: Minor
                  Found in tools/isobuild/linker.js - About 45 mins 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 fullLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export var fullLink = Profile("linker.fullLink", function (inputFiles, {
                    // True if we're linking the application (as opposed to a
                    // package). Among other consequences, this makes the top level
                    // namespace be the same as the global namespace, so that symbols are
                    // accessible from the console, and avoids actually combining files into
                  Severity: Minor
                  Found in tools/isobuild/linker.js - About 35 mins 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 _getClosureHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _getClosureHeader() {
                      if (this.meteorInstallOptions) {
                        const headerParts = ["function module("];
                  
                        if (this.source.match(/\b__dirname\b/)) {
                  Severity: Minor
                  Found in tools/isobuild/linker.js - About 35 mins 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 getFooter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var getFooter = function ({
                    name,
                    exported,
                    exportsName,
                  }) {
                  Severity: Minor
                  Found in tools/isobuild/linker.js - About 25 mins 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

                  There are no issues that match your filters.

                  Category
                  Status