meteor/meteor

View on GitHub
tools/utils/buildmessage.js

Summary

Maintainability
F
3 days
Test Coverage

File buildmessage.js has 446 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var _ = require('underscore');
var files = require('../fs/files');
var parseStack = require('./parse-stack');
var fiberHelpers = require('./fiber-helpers.js');
var Progress = require('../console/progress').Progress;
Severity: Minor
Found in tools/utils/buildmessage.js - About 6 hrs to fix

    Function enterJob has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function enterJob(options, f) {
      if (typeof options === "function") {
        f = options;
        options = {};
      }
    Severity: Major
    Found in tools/utils/buildmessage.js - About 2 hrs to fix

      Function enterJob has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function enterJob(options, f) {
        if (typeof options === "function") {
          f = options;
          options = {};
        }
      Severity: Minor
      Found in tools/utils/buildmessage.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 formatMessages has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        formatMessages: function (indent) {
          var self = this;
          var out = "";
          var already = {};
          indent = new Array((indent || 0) + 1).join(' ');
      Severity: Major
      Found in tools/utils/buildmessage.js - About 2 hrs to fix

        Function capture has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function capture(options, f) {
          var messageSet = new MessageSet;
          var parentMessageSet = currentMessageSet.get();
        
          var title;
        Severity: Minor
        Found in tools/utils/buildmessage.js - About 1 hr to fix

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

          var error = function (message, options) {
            options = options || {};
          
            if (options.downcase) {
              message = message.slice(0,1).toLowerCase() + message.slice(1);
          Severity: Minor
          Found in tools/utils/buildmessage.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 forkJoin has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var forkJoin = function (options, iterable, fn) {
            if (!_.isFunction(fn)) {
              fn = iterable;
              iterable = options;
              options = {};
          Severity: Minor
          Found in tools/utils/buildmessage.js - About 1 hr to fix

            Function exception has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var exception = function (error) {
              if (! currentJob.get()) {
                // XXX this may be the wrong place to do this, but it makes syntax errors in
                // files loaded via isopack.load have context.
                if (error instanceof files.FancySyntaxError) {
            Severity: Minor
            Found in tools/utils/buildmessage.js - About 1 hr to fix

              Function error has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var error = function (message, options) {
                options = options || {};
              
                if (options.downcase) {
                  message = message.slice(0,1).toLowerCase() + message.slice(1);
              Severity: Minor
              Found in tools/utils/buildmessage.js - About 1 hr to fix

                Function exception has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                var exception = function (error) {
                  if (! currentJob.get()) {
                    // XXX this may be the wrong place to do this, but it makes syntax errors in
                    // files loaded via isopack.load have context.
                    if (error instanceof files.FancySyntaxError) {
                Severity: Minor
                Found in tools/utils/buildmessage.js - About 55 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 capture has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function capture(options, f) {
                  var messageSet = new MessageSet;
                  var parentMessageSet = currentMessageSet.get();
                
                  var title;
                Severity: Minor
                Found in tools/utils/buildmessage.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

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

                    try {
                      return f();
                    } finally {
                      progress.reportProgressDone();
                
                
                Severity: Major
                Found in tools/utils/buildmessage.js and 1 other location - About 3 hrs to fix
                tools/utils/buildmessage.js on lines 387..406

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

                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

                  try {
                    return f();
                  } finally {
                    progress.reportProgressDone();
                
                
                Severity: Major
                Found in tools/utils/buildmessage.js and 1 other location - About 3 hrs to fix
                tools/utils/buildmessage.js on lines 355..368

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

                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

                    if (debugBuild) {
                      start = Date.now();
                      console.log(spaces(nestingLevel * 2), "START", nestingLevel, options.title);
                    }
                Severity: Minor
                Found in tools/utils/buildmessage.js and 1 other location - About 35 mins to fix
                tools/utils/buildmessage.js on lines 382..385

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

                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

                  if (debugBuild) {
                    start = Date.now();
                    console.log(spaces(nestingLevel * 2), "START", nestingLevel, options.title);
                  }
                Severity: Minor
                Found in tools/utils/buildmessage.js and 1 other location - About 35 mins to fix
                tools/utils/buildmessage.js on lines 348..351

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

                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

                There are no issues that match your filters.

                Category
                Status