Showing 121 of 129 total issues
Function getPatchEmitFunction
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getPatchEmitFunction () {
const plugin = this
return (original: RequestFunction): Func<http2.ClientHttp2Stream> => {
return function patchedEmit (
this: http2.Http2Server, event: string,
File inspectorProfiler.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ProfilerType } from '../features/profiling'
import Configuration from '../configuration'
import { ServiceManager } from '../serviceManager'
import { Transport } from '../services/transport'
Function outgoingRequest
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function outgoingRequest (
options: httpModule.RequestOptions | string,
callback): httpModule.ClientRequest {
if (!options) {
return original.apply(this, arguments)
Function patchedEmit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function patchedEmit (
this: http2.Http2Server, event: string,
stream: http2.ServerHttp2Stream,
headers: http2.IncomingHttpHeaders): http2.ClientHttp2Stream {
if (event !== 'stream') {
Function _sink
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_sink (sinkIndex) {
const sinkElement = this._elements[sinkIndex]
const sinkScore = this._score(sinkElement)
const length = this._elements.length
- 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 metrics
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
metrics (metric: MetricBulk | Array<MetricBulk>): any[] {
const res: any[] = []
// tslint:disable-next-line
if (metric === undefined || metric === null) {
Function listener
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private listener (data) {
this.logger(`Received new message from reverse`)
if (!data) return false
const actionName = data.msg ? data.msg : data.action_name ? data.action_name : data
Function aggregate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
aggregate (packet) {
if (this.validateData(packet) === false) return false
// Get http path of current span
let path = packet.spans[0].labels['http/path']
Function init
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
init (config?: IOConfig) {
const callsite = (new Error().stack || '').split('\n')[2]
if (callsite && callsite.length > 0) {
this.logger(`init from ${callsite}`)
}
Function init
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
init (): void {
this.transport = ServiceManager.get('transport')
if (this.transport === null) return this.logger('Failed to init metrics service cause no transporter')
this.logger('init')
- 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 getPatchIncomingRequestFunction
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getPatchIncomingRequestFunction () {
return (original: (event: string) => boolean) => {
const plugin = this
// This function's signature is that of an event listener, which can have
// any number of variable-type arguments.
Function getMakeHttp2RequestTraceFunction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getMakeHttp2RequestTraceFunction (
request: http2.ClientHttp2Stream, headers: http2.OutgoingHttpHeaders,
authority: string, plugin: Http2Plugin): Func<http2.ClientHttp2Stream> {
return (span: Span): http2.ClientHttp2Stream => {
if (!span) return request
Function getPatchSendCommand
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getPatchSendCommand () {
const plugin = this
const addArguments = typeof this.options === 'object'
&& this.options.detailedCommands === true
Function compareList
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
compareList (one: any[], two: any[]) {
if (one.length !== two.length) return false
for (let i = 0; i < one.length; i++) {
if (one[i].name !== two[i].name) return 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 init
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
init (config: IOConfig): void {
this.logger('init tracing')
if (config.tracing === undefined) {
config.tracing = defaultTracingConfig
- 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 listener
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private listener (data) {
this.logger(`Received new message from reverse`)
if (!data) return false
const actionName = data.msg ? data.msg : data.action_name ? data.action_name : data
- 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 incomingRequest
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function incomingRequest (event: string, ...args: any[]): boolean {
// Only traces request events
if (event !== 'connection') {
return original.apply(this, arguments)
}
Function registerAction
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerAction (actionName?: string, opts?: Object | undefined | Function, handler?: Function): void {
if (typeof opts === 'function') {
handler = opts
opts = undefined
}
Function mergeTrace
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
mergeTrace (aggregated, trace) {
if (!aggregated || !trace) return
// if the trace doesn't any spans stop aggregation here
if (trace.spans.length === 0) return
Function onHeapProfileStart
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private onHeapProfileStart (opts, cb) {
if (typeof cb !== 'function') {
cb = opts
opts = {}
}