Showing 193 of 258 total issues
Function describeStart
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function describeStart (yargs) {
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'START - Start the server / do a single run.\n\n' +
'Usage:\n' +
Function createRunnerMiddleware
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
function createRunnerMiddleware (emitter, fileList, capturedBrowsers, reporter, executor,
/* config.protocol */ protocol, /* config.hostname */ hostname, /* config.port */
port, /* config.urlRoot */ urlRoot, config) {
Function factory
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
id, fullName, /* capturedBrowsers */ collection, emitter, socket, timer,
/* config.browserDisconnectTimeout */ disconnectDelay,
/* config.browserNoActivityTimeout */ noActivityTimeout,
/* config.singleRun */ singleRun,
/* config.client */ clientConfig) {
Function complete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function complete (env) {
if (env.count === 1) {
return sendCompletion(env.words[0].startsWith('-') ? ['--help', '--version'] : Object.keys(options), env)
} else if (env.count === 2 && !env.words[1].startsWith('-')) {
return sendCompletionFiles(env)
- 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 DotsReporter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function DotsReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
const DOTS_WRAP = 80
this.EXCLUSIVELY_USE_COLORS = false
- 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 createSourceFilesMiddleware
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSourceFilesMiddleware (filesPromise, serveFile, basePath, urlRoot) {
return function (request, response, next) {
const requestedFilePath = composeUrl(request.url, basePath, urlRoot)
// When a path contains HTML-encoded characters (e.g %2F used by Jenkins for branches with /)
const requestedFilePathUnescaped = composeUrl(querystring.unescape(request.url), basePath, urlRoot)
Function init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.init = function (config) {
logger.setupFromConfig(config)
const colorScheme = !helper.isDefined(config.colors) || config.colors ? COLOR_SCHEME.ON : COLOR_SCHEME.OFF
// need to be registered before creating readlineInterface
Function files
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
get files () {
const served = []
const included = {}
const lookup = {}
this._patterns.forEach((p) => {
Function describeRun
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function describeRun (yargs) {
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'RUN - Run the tests (requires running server).\n\n' +
'Usage:\n' +
Function complete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.complete = function (result) {
if (resultsBuffer.length) {
socket.emit('result', resultsBuffer)
resultsBuffer = []
}
Function complete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.complete = function (result) {
if (resultsBuffer.length) {
socket.emit('result', resultsBuffer)
resultsBuffer = []
}
Function encode
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function encode (str, opts) {
if (typeof str !== 'string') {
throw new TypeError('Expected a String');
}
if (!opts) opts = {};
Function encode
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function encode (str, opts) {
if (typeof str !== 'string') {
throw new TypeError('Expected a String');
}
if (!opts) opts = {};
Function _execCommand
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this._execCommand = function (cmd, args) {
if (!cmd) {
log.error(`No binary for ${self.name} browser on your platform.\n Please, set "${self.ENV_CMD}" env variable.`)
// disable restarting
Function createProxyHandler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createProxyHandler (proxies, urlRoot) {
if (!proxies.length) {
const nullProxy = (request, response, next) => next()
nullProxy.upgrade = () => {}
return nullProxy
Function createPriorityPreprocessor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createPriorityPreprocessor (config = {}, preprocessorPriority, basePath, instantiatePlugin) {
_.union.apply(_, Object.values(config)).forEach((name) => instantiatePlugin('preprocessor', name))
return async function preprocess (file) {
const buffer = await tryToRead(file.originalPath, log)
let isBinary = file.isBinary
Function createInstantiatePlugin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function createInstantiatePlugin (injector) {
const emitter = injector.get('emitter')
// Cache to avoid report errors multiple times per plugin.
const pluginInstances = new Map()
return function instantiatePlugin (kind, name) {
- 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 parser
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const parser = (pattern, out) => {
if (pattern.length === 0) return out
const p = /^(\[[^\]]*\]|[*+@?]\((.+?)\))/g
const matches = p.exec(pattern)
if (!matches) {
- 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 result
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.result = function (originalResult) {
var convertedResult = {}
// Convert all array-like objects to real arrays.
for (var propertyName in originalResult) {
Function result
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.result = function (originalResult) {
var convertedResult = {}
// Convert all array-like objects to real arrays.
for (var propertyName in originalResult) {