Showing 17 of 34 total issues
File index.ts
has 719 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/unified-signatures */
/* eslint-disable no-prototype-builtins */
import { RequestOptions } from "https";
import * as url from "url";
InfluxDB
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
export class InfluxDB {
/**
* Connect pool for making requests.
* @private
*/
File pool.ts
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IBackoffStrategy } from "./backoff/backoff";
import { ExponentialBackoff } from "./backoff/exponential";
import { Host } from "./host";
import * as http from "http";
Function stream
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public stream(
options: IPoolRequestOptions,
callback: (err: Error, res: http.IncomingMessage) => void
): void {
if (!this.hostIsAvailable()) {
File times.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-fallthrough */
import { isNumeric } from "./ds";
/**
Function coerceFields
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public coerceFields(fields: FieldMap): Array<[string, string]> {
let consumed = 0;
const output: Array<[string, string]> = [];
this._fieldNames.forEach((field) => {
Function ping
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ping(
timeout: number,
path: string = "/ping",
auth: string | undefined = undefined
): Promise<IPingStats[]> {
Function parseInner
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function parseInner(
series: IResponseSeries[] = [],
precision?: TimePrecision
): IResults<any> {
const results: any = [];
- 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 writePoints
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public writePoints(
points: IPoint[],
options: IWriteOptions = {}
): Promise<void> {
const {
Function value
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public value(value: any): this {
switch (typeof value) {
case "number":
this._query.push(value.toString());
return this;
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options?: any) {
// Figure out how to parse whatever we were passed in into a IClusterConfig.
if (typeof options === "string") {
// Plain URI => ISingleHostConfig
options = parseOptionsUrl(options);
Function value
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public value(value: any): this {
switch (typeof value) {
case "number":
this._query.push(value.toString());
return this;
Function parseInner
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseInner(
series: IResponseSeries[] = [],
precision?: TimePrecision
): IResults<any> {
const results: any = [];
Function groupMethod
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function groupMethod(this: any, matcher: Tags): Row[] {
// We do a tiny bit of 'custom' deep equality checking here, taking
// advantage of the fact that the tag keys are consistent across all
// series results. This lets us match groupings much more efficiently,
// ~6000x faster than the fastest vanilla equality checker (lodash)
- 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 stream
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public stream(
options: IPoolRequestOptions,
callback: (err: Error, res: http.IncomingMessage) => void
): void {
if (!this.hostIsAvailable()) {
- 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
return this;
Avoid too many return
statements within this function. Open
return this;