Showing 193 of 258 total issues
Function processAnswers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processAnswers (answers, basePath, testMainFile) {
const processedAnswers = {
basePath: basePath,
files: answers.files,
onlyServedFiles: [],
Function msg
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
let msg = input.replace(URL_REGEXP, function (stackTracePath, prefix, path, __, ___, line, ____, column) {
Function createKarmaMiddleware
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
filesPromise,
serveStaticFile,
serveFile,
injector,
basePath,
Function createPatternObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function createPatternObject (pattern) {
if (pattern && helper.isString(pattern)) {
return helper.isUrlAbsolute(pattern)
? new UrlPattern(pattern)
: new Pattern(pattern)
- 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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.run = async () => {
const cliOptions = exports.process()
const cmd = cliOptions.cmd // prevent config from changing the command
const cmdNeedsConfig = cmd === 'start' || cmd === 'run' || cmd === 'stop'
if (cmdNeedsConfig) {
- 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 Karma
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function Karma (updater, socket, iframe, opener, navigator, location, document) {
Function Karma
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function Karma (updater, socket, iframe, opener, navigator, location, document) {
Avoid deeply nested control flow statements. Open
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
Avoid deeply nested control flow statements. Open
if (q < t) {
break;
}
Avoid deeply nested control flow statements. Open
if (ele.tagName && ele.tagName.toLowerCase() === 'script') {
var tmp = ele
ele = document.createElement('script')
ele.src = policy.createScriptURL(tmp.src)
ele.crossOrigin = tmp.crossOrigin
Avoid deeply nested control flow statements. Open
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (first) {
first = false
} else {
Function createProxyHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function createProxyHandler (proxies, urlRoot) {
if (!proxies.length) {
const nullProxy = (request, response, next) => next()
nullProxy.upgrade = () => {}
return nullProxy
- 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 deeply nested control flow statements. Open
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
Avoid deeply nested control flow statements. Open
if (obj.constructor && typeof obj.constructor === 'function') {
constructor = obj.constructor.name
}
Function reconnect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
reconnect (newSocket, clientSaysReconnect) {
if (!clientSaysReconnect || this.state === DISCONNECTED) {
this.log.info(`Disconnected browser returned on socket ${newSocket.id} with id ${this.id}.`)
this.setState(CONNECTED)
- 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 deeply nested control flow statements. Open
if (ele.tagName && ele.tagName.toLowerCase() === 'script') {
var tmp = ele
ele = document.createElement('script')
ele.src = policy.createScriptURL(tmp.src)
ele.crossOrigin = tmp.crossOrigin
Avoid deeply nested control flow statements. Open
if (obj.constructor && typeof obj.constructor === 'function') {
constructor = obj.constructor.name
}
Avoid deeply nested control flow statements. Open
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (first) {
first = false
} else {
Avoid deeply nested control flow statements. Open
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (first) {
first = false
} else {
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor (cliOptionsOrConfig, done) {
super()
cliOptionsOrConfig = cliOptionsOrConfig || {}
this.log = logger.create('karma-server')
done = helper.isFunction(done) ? done : process.exit
- 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"