Showing 121 of 129 total issues
Function internalSendCommandWrap
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function internalSendCommandWrap (original: Function) {
return function internal_send_command_trace (command: IORedisCommand) {
if (!plugin.tracer.currentRootSpan) {
return original.apply(this, arguments)
}
Function registerHttpMetric
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private registerHttpMetric () {
if (this.metricService === undefined) return this.logger(`Failed to load metric service`)
const histogram = new Histogram()
const p50: InternalMetric = {
name: `HTTP Mean Latency`,
Function registerHttpsMetric
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private registerHttpsMetric () {
if (this.metricService === undefined) return this.logger(`Failed to load metric service`)
const histogram = new Histogram()
const p50: InternalMetric = {
name: `HTTPS Mean Latency`,
Function onCPUProfileStart
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private onCPUProfileStart (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
Function init
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init (config?: V8MetricsConfig | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
Function loadPlugins
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadPlugins (pluginList: PluginNames) {
if (this.hookState === HookState.UNINITIALIZED) {
hook(Object.keys(pluginList), (exports, name, basedir) => {
if (this.hookState !== HookState.ENABLED) {
return exports
Function getPatchCommand
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getPatchCommand (label: string) {
const plugin = this
return (original: Function) => {
return function (ns: string, command: any, options: any, callback: Function) {
const resultHandler = typeof options === 'function' ? options : callback
Function internal_send_command_trace
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function internal_send_command_trace (command: IORedisCommand) {
if (!plugin.tracer.currentRootSpan) {
return original.apply(this, arguments)
}
Function koaErrorHandler
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
koaErrorHandler () {
const self = this
Configuration.configureModule({
error : true
})
Function init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function onCPUProfileStop
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private onCPUProfileStop (cb) {
if (this.currentProfile === null) {
return cb({
err: 'No profiling are already running',
success: false
Function patchSubmittable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private patchSubmittable (pgQuery, span) {
const plugin = this
let spanEnded = false
if (pgQuery.handleError) {
shimmer.wrap(pgQuery, 'handleError', (origCallback) => {
Function onHeapdump
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private onHeapdump (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}
Function init
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
init (config?: IOConfig) {
const callsite = (new Error().stack || '').split('\n')[2]
if (callsite && callsite.length > 0) {
this.logger(`init from ${callsite}`)
}
- 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 mergeTrace
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
mergeTrace (aggregated, trace) {
if (!aggregated || !trace) return
// if the trace doesn't any spans stop aggregation here
if (trace.spans.length === 0) return
- 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 getPatchSendCommand
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getPatchSendCommand () {
const plugin = this
const addArguments = typeof this.options === 'object'
&& this.options.detailedCommands === true
return function internalSendCommandWrap (original: Function) {
Function findPackageJson
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static findPackageJson () {
try {
require.main = Configuration.getMain()
} catch (_e) {
// Ignore error when getter is set on require.main, but no setter
Function expressErrorHandler
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
expressErrorHandler () {
const self = this
Configuration.configureModule({
error : true
})
Function catchDownload
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private catchDownload () {
if (this.metricService === undefined) return this.logger(`Failed to load metric service`)
const downloadMeter = new Meter({})
this.metricService.registerMetric({
Function init
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init (config?: ProfilingConfig | boolean) {
if (config === true) {
config = defaultProfilingConfig
} else if (config === false) {
config = disabledProfilingConfig