Showing 121 of 129 total issues
Function findPackageJson
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static findPackageJson () {
try {
require.main = Configuration.getMain()
} catch (_e) {
// Ignore error when getter is set on require.main, but no setter
- 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 percentiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
percentiles (percentiles) {
const values = this._sample
.toArray()
.sort(function (a, b) {
return (a === b)
- 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 init
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
init (config?: ProfilingConfig | boolean) {
if (config === true) {
config = defaultProfilingConfig
} else if (config === false) {
config = disabledProfilingConfig
- 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 getObjectAtPath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getObjectAtPath (context: Object, path: string): any {
if (path.indexOf('.') === -1 && path.indexOf('[') === -1) {
return context[path]
}
- 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 assertSpanAttributes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
span: Span, httpStatusCode: number, httpMethod: string, hostName: string,
path: string, userAgent?: string) {
Function onCPUProfileStart
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private onCPUProfileStart (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
- 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 assertSpanAttributes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
span: Span, httpStatusCode: number, httpMethod: string, hostName: string,
path: string, userAgent?: string) {
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
init () {
for (const moduleName of this.modules) {
let path = utils.detectModule(moduleName)
// continue to search if we dont find it
if (path === null) continue
- 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 assertSpanAttributes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
span: Span, httpStatusCode: number, httpMethod: string, hostName: string,
path: string, userAgent?: string) {
Function onHeapProfileStart
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private onHeapProfileStart (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
- 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 autoExitHook
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private autoExitHook () {
// clean listener if event loop is empty
// important to ensure apm will not prevent application to stop
this.autoExitHandle = setInterval(() => {
let currentProcess: any = (cluster.isWorker) ? cluster.worker.process : process
- 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
Consider simplifying this complex logical expression. Open
if (typeof (options) === 'string') {
const parsedUrl = url.parse(options)
options = parsedUrl
pathname = parsedUrl.pathname || '/'
origin = `${parsedUrl.protocol || 'http:'}//${parsedUrl.host}`
Function doNock
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
url: string, path: string, httpCode: number, respBody: string,
times?: number) {
Function doNock
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
url: string, path: string, httpCode: number, respBody: string,
times?: number) {
Function patchEnd
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
patchEnd (span: Span, resultHandler: Function): Function {
const plugin = this
const patchedEnd = function (err, res) {
if (plugin.options.detailedCommands === true && err instanceof Error) {
span.addAttribute('error', err.message)
- 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 patchEnd
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
patchEnd (span: Span, resultHandler: Function): Function {
const plugin = this
const patchedEnd = function (err, res) {
if (plugin.options.detailedCommands === true && err instanceof Error) {
span.addAttribute('error', err.message)
- 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 expressErrorHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
expressErrorHandler () {
const self = this
Configuration.configureModule({
error : true
})
- 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
if (one[i].labels.length !== two[i].labels.length) return false
Avoid too many return
statements within this function. Open
return plugin.tracer.startRootSpan(
traceOptions,
plugin.getMakeRequestTraceFunction(request, options, plugin))
Avoid too many return
statements within this function. Open
return original.apply(this, arguments)