Showing 8 of 16 total issues
Function newrelic
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function newrelic(this: any, options: NewRelicOptions) {
const isPluginEnabled = options && options.enabled
if(!isPluginEnabled) {
return
Function MetricsCollector
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function MetricsCollector(metricApiKey: string) {
const metricsClient = new MetricClient({
apiKey: metricApiKey,
});
Function preload
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function preload(this: any, opts: any) {
const seneca = this;
const { options }: { options: NewRelicOptions } = opts;
const isPluginEnabled = options && options.enabled
Function sendTracing
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
sendTracing(spec: TelemetrySpecMetadata): Promise<string|void|boolean> {
return new Promise((resolve, reject) => {
const spanBatch = new SpanBatch();
const span = new Span(
Function addSegment
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addSegment(spec: Spec) {
if (spec.ctx.actdef?.func) {
const { ctx, data } = spec
const pattern = ctx.actdef.pattern
const origfunc = ctx.actdef.func
Function preload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function preload(this: any, opts: any) {
const seneca = this;
const { options }: { options: NewRelicOptions } = opts;
const isPluginEnabled = options && options.enabled
- 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 _updateSpecList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async _updateSpecList(specMetadata: TelemetrySpecMetadata) {
const spec = this.specList.find((s) => s.mi_id === specMetadata.mi_id);
if (spec) {
Object.assign(spec, specMetadata);
if (spec.manualEndTime && spec.manualStartTime && !spec.dispatched) {
- 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 MetricsCollector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function MetricsCollector(metricApiKey: string) {
const metricsClient = new MetricClient({
apiKey: metricApiKey,
});
- 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"