Showing 24 of 140 total issues
Function worker
has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring. Open
function worker() {
var self = this
function $$evalExpr(expr) {
var fn = null
- 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
File thread.js
has 876 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! thread.js - v0.1.16 - MIT License - https://github.com/h2non/thread.js */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.thread=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var _ = require('./utils')
var workerSrc = require('./worker')
Function 8
has 245 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{}],8:[function(require,module,exports){
module.exports = worker
function worker() {
var self = this
Function worker
has 242 lines of code (exceeds 25 allowed). Consider refactoring. Open
function worker() {
var self = this
function $$evalExpr(expr) {
var fn = null
Function worker
has 242 lines of code (exceeds 25 allowed). Consider refactoring. Open
function worker() {
var self = this
function $$evalExpr(expr) {
var fn = null
Function isolated
has 233 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function isolated() {
'use strict'
var namespace = 'env'
var isWorker = typeof document === 'undefined'
Function isolated
has 233 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function isolated() {
'use strict'
var namespace = 'env'
var isWorker = typeof document === 'undefined'
Function 6
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"./utils":7}],6:[function(require,module,exports){
var _ = require('./utils')
var workerSrc = require('./worker')
var Task = require('./task')
var FakeWorker = require('./fake-worker')
Function 5
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"./utils":7}],5:[function(require,module,exports){
var _ = require('./utils')
module.exports = Task
Function 1
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.thread=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var _ = require('./utils')
var workerSrc = require('./worker')
var eventMethod = window.addEventListener ? 'addEventListener' : 'attachEvent'
Function 7
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"./fake-worker":1,"./pool":3,"./store":4,"./task":5,"./utils":7,"./worker":8}],7:[function(require,module,exports){
var _ = exports
var toStr = Object.prototype.toString
var slice = Array.prototype.slice
var hasOwn = Object.prototype.hasOwnProperty
Function 3
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"./store":4,"./thread":6}],3:[function(require,module,exports){
var _ = require('./utils')
module.exports = threadPool
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
var customLaunchers = {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
Function 4
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
},{"./utils":7}],4:[function(require,module,exports){
var _ = require('./utils')
var buf = []
var store = module.exports = {}
Function each
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.each = function (obj, fn) {
var i, l
if (_.isArr(obj))
for (i = 0, l = obj.length; i < l; i += 1) fn(obj[i], i)
else if (_.isObj(obj))
- 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 dispatcher
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function dispatcher(self, value) {
return function recur(pool) {
var fn = null
if (_.isArr(pool)) {
fn = pool.shift()
- 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 uuid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.uuid = function () {
var uuid = '', i, random
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += '-'
- 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 findBestAvailableThread
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function findBestAvailableThread(threads, offset) {
var thread, pending
for (var i = 0, l = threads.length; i < l; i += 1) {
thread = threads[i]
pending = thread.pending()
- 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 exec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Task.prototype.run = Task.prototype.exec = function (fn, env, args) {
var thread = this.thread
if (!thread || thread._terminated) {
throw new Error('cannot execute the task. The thread was terminated')
- 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 removeEventListener
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
FakeWorker.prototype.removeEventListener = function (type, fn) {
var index, pool = this.listeners[type]
if (pool) {
if (_.isFn(fn)) {
pool.splice(0, pool.length)
- 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"