Showing 7 of 7 total issues
Function filterConfig
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function filterConfig(config) {
// check the required parameters
if (!isStrictObject(config)) { throw new TypeError('Expecting a valid config object'); }
if (!isNonEmptyString(config.path)) { throw new Error('Expecting a path for the workers module'); }
- 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 start
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Pool.prototype.start = function() {
var self = this;
function removeJob(worker, wasSuccessfull) {
var job = removeFromArray(self._jobs.assigned, function(job) { return (job.worker===worker); });
removeFromArray(self._workers.busy, worker);
Function createWorker
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createWorker(config) {
return new _ForkedWorker(config)
.on('started', function(worker) {
if (self._hasWorker(worker)) {
self._workers.idle.push(worker);
Function _ForkedWorker
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _ForkedWorker(config) {
if (!(this instanceof _ForkedWorker)) {
return new _ForkedWorker(config);
}
Function ForkedWorker
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ForkedWorker() {
if (!(this instanceof ForkedWorker)) {
return new ForkedWorker();
}
var self = this;
Function _ForkedWorker
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function _ForkedWorker(config) {
if (!(this instanceof _ForkedWorker)) {
return new _ForkedWorker(config);
}
- 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 start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Pool.prototype.start = function() {
var self = this;
function removeJob(worker, wasSuccessfull) {
var job = removeFromArray(self._jobs.assigned, function(job) { return (job.worker===worker); });
removeFromArray(self._workers.busy, worker);
- 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"