Lewerow/Zurvan

View on GitHub

Showing 13 of 17 total issues

Function advanceTime has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

TimeForwarder.prototype.advanceTime = function(timeToForward) {
  var advanceStep = new TimeUnit(timeToForward);
  var that = this;

  return new that.schedule.Promise(function(resolve, reject) {
Severity: Major
Found in detail/TimeForwarder.js - About 3 hrs to fix

    Function interceptTimers has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Zurvan.prototype.interceptTimers = function(config) {
      var newConfig = Configuration.merge(config, this.globalConfig);
      newConfig.debugLogger('intercepting timers');
    
      // this error has to be synchronous, since we do not know yet whether the system supports Promises
    Severity: Major
    Found in zurvan.js - About 2 hrs to fix

      Function fireTimersOneByOne has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function fireTimersOneByOne() {
            if (that.immediateInterceptor.areAwaiting()) {
              if (
                ++currentSetImmediateBatchSize >=
                that.config.maxAllowedSetImmediateBatchSize
      Severity: Major
      Found in detail/TimeForwarder.js - About 2 hrs to fix

        Function fakeDate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function fakeDate(timeServer) {
          var OriginalDate = global.Date;
        
          function makeOriginalDateFromArgs(
            yearOrTimeAsStringOrTimestamp,
        Severity: Major
        Found in detail/DateInterceptor.js - About 2 hrs to fix

          Function negativeTimeSinceStartup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function negativeTimeSinceStartup(config) {
              if (
                TypeChecks.isNumber(config.timeSinceStartup) &&
                config.timeSinceStartup < 0
              ) {
          Severity: Minor
          Found in detail/Configuration.js - About 1 hr to fix

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

            ImmediateInterceptor.prototype.intercept = function(config) {
              this.config = config;
            
              this.setImmediates = new FieldOverrider(
                global,
            Severity: Minor
            Found in detail/ImmediateInterceptor.js - About 1 hr to fix

              Function blockSystem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              TimeForwarder.prototype.blockSystem = function(timeToBlock) {
                var blockStep = new TimeUnit(timeToBlock);
                assertValidBlockStep(blockStep);
              
                if (!this.isExpiringEvents()) {
              Severity: Minor
              Found in detail/TimeForwarder.js - About 1 hr to fix

                Function missingDependencies has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function missingDependencies(deps, context) {
                  return Object.keys(deps)
                    .map(function(key) {
                      return { name: key, statuses: deps[key].status(context) };
                    })
                Severity: Minor
                Found in detail/Dependencies.js - About 1 hr to fix

                  Function defaultConfiguration has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function defaultConfiguration() {
                    var Promise = global.Promise;
                    if (!Promise) {
                      try {
                        Promise = require('bluebird');
                  Severity: Minor
                  Found in detail/Configuration.js - About 1 hr to fix

                    Function negativeTimeSinceStartup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      function negativeTimeSinceStartup(config) {
                        if (
                          TypeChecks.isNumber(config.timeSinceStartup) &&
                          config.timeSinceStartup < 0
                        ) {
                    Severity: Minor
                    Found in detail/Configuration.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 createCallDelay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    TimerInterceptor.prototype.createCallDelay = function(requestedCallDelay) {
                      if (!TypeChecks.isNumber(requestedCallDelay)) {
                        if (this.config.denyImplicitTimer) {
                          throw new Error(
                            timerCreateErrorMessage('a numeric value', requestedCallDelay)
                    Severity: Minor
                    Found in detail/TimerInterceptor.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 fakeDate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function fakeDate(timeServer) {
                      var OriginalDate = global.Date;
                    
                      function makeOriginalDateFromArgs(
                        yearOrTimeAsStringOrTimestamp,
                    Severity: Minor
                    Found in detail/DateInterceptor.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

                    Avoid too many return statements within this function.
                    Open

                      return nextIntervals;
                    Severity: Major
                    Found in detail/AllTimersInterceptor.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language