Showing 76 of 82 total issues
Function metrics
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
metrics (metric: MetricBulk | Array<MetricBulk>): any[] {
const res: any[] = []
// tslint:disable-next-line
if (metric === undefined || metric === 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
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (opts?) {
opts = opts || {}
this._measurement = opts.measurement
this._callFn = null
Function onCPUProfileStop
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private onCPUProfileStop (cb) {
if (this.currentProfile === null) {
return cb({
err: 'No profiling are already running',
success: false
Function hookHttp
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private hookHttp (nodule: any, name: string) {
if (nodule.Server === undefined || nodule.Server.prototype === undefined) return
if (this.modules[name] !== undefined) return this.logger(`Module ${name} already hooked`)
this.logger(`Hooking to ${name} module`)
this.modules[name] = nodule.Server.prototype
Function onCPUProfileStart
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private onCPUProfileStart (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
Function _sink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_sink (sinkIndex) {
const sinkElement = this._elements[sinkIndex]
const sinkScore = this._score(sinkElement)
const length = this._elements.length
Function metric
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
metric (opts: Metric): Gauge {
let metric: InternalMetric
if (typeof opts.value === 'function') {
metric = {
name: opts.name,
Function onHeapdump
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private onHeapdump (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
Function percentiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
percentiles (percentiles) {
const values = this._sample
.toArray()
.sort(function (a, b) {
return (a === b)
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 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 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 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 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 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
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 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 (j === 0) return segments.join('/')
Avoid too many return
statements within this function. Open
return segments.join('/')