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) {
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
Function fireTimersOneByOne
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fireTimersOneByOne() {
if (that.immediateInterceptor.areAwaiting()) {
if (
++currentSetImmediateBatchSize >=
that.config.maxAllowedSetImmediateBatchSize
Function fakeDate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fakeDate(timeServer) {
var OriginalDate = global.Date;
function makeOriginalDateFromArgs(
yearOrTimeAsStringOrTimestamp,
Function negativeTimeSinceStartup
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function negativeTimeSinceStartup(config) {
if (
TypeChecks.isNumber(config.timeSinceStartup) &&
config.timeSinceStartup < 0
) {
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,
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()) {
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) };
})
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');
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
) {
- Read upRead up
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)
- Read upRead up
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,
- Read upRead up
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;