Showing 121 of 129 total issues
Function getPatchSendCommand
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
private getPatchSendCommand () {
const plugin = this
const addArguments = typeof this.options === 'object'
&& this.options.detailedCommands === 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
Function init
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
init (config?: RuntimeMetricsOptions | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
File http.ts
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
Function getPatchSendCommand
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private getPatchSendCommand () {
const plugin = this
const addArguments = typeof this.options === 'object'
&& this.options.detailedCommands === true
return function internalSendCommandWrap (original: Function) {
- 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
File transactionAggregator.ts
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
import * as Debug from 'debug'
import { EventEmitter2 } from 'eventemitter2'
import EWMA from './EWMA'
Function matchPath
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
matchPath (path, routes) {
// empty route is / without the fist slash
if (!path || !routes) return false
if (path === '/') return routes[path] ? path : 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
File http.spec.ts
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
Function init
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
init (config: IOConfig): void {
this.logger('init tracing')
if (config.tracing === undefined) {
config.tracing = defaultTracingConfig
Function init
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
init (config?: EventLoopMetricOption | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
File https.spec.ts
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
Function init
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
init (config?: RuntimeMetricsOptions | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
- 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 70 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 init
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
init (config?: V8MetricsConfig | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
- 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 getMakeRequestTraceFunction
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getMakeRequestTraceFunction (
request: httpModule.ClientRequest, options: httpModule.RequestOptions,
plugin: HttpPlugin): Func<httpModule.ClientRequest> {
return (span: Span): httpModule.ClientRequest => {
plugin.logger.debug('makeRequestTrace')
Function prepareAggregationforShipping
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareAggregationforShipping () {
let routes = this.cache.routes
const normalized: Trace = {
routes: [],
Function incomingRequest
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function incomingRequest (event: string, ...args: any[]): boolean {
// Only traces request events
if (event !== 'request') {
return original.apply(this, arguments)
}
Function init
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
init (config?: EventLoopMetricOption | boolean) {
if (config === false) return
if (config === undefined) {
config = defaultOptions
}
- 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 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
static init (conf, doNotTellPm2?) {
const packageFilepath = Configuration.findPackageJson()
let packageJson
if (!conf.module_conf) {
Function getPatchOutgoingRequestFunction
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getPatchOutgoingRequestFunction () {
return (original: Func<httpModule.ClientRequest>): Func<
httpModule.ClientRequest> => {
const plugin = this
const kind = plugin.moduleName === 'https' ? 'HTTPS' : 'HTTP'
Function init
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static init (conf, doNotTellPm2?) {
const packageFilepath = Configuration.findPackageJson()
let packageJson
if (!conf.module_conf) {
- 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"