bencevans/node-influx

View on GitHub

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";
Severity: Major
Found in src/index.ts - About 1 day to fix

    InfluxDB has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class InfluxDB {
      /**
       * Connect pool for making requests.
       * @private
       */
    Severity: Minor
    Found in src/index.ts - About 4 hrs to fix

      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";
      Severity: Minor
      Found in src/pool.ts - About 4 hrs to fix

        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()) {
        Severity: Major
        Found in src/pool.ts - About 2 hrs to fix

          File times.ts has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable no-fallthrough */
          
          import { isNumeric } from "./ds";
          
          /**
          Severity: Minor
          Found in src/grammar/times.ts - About 2 hrs to fix

            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) => {
            Severity: Major
            Found in src/schema.ts - About 2 hrs to fix

              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[]> {
              Severity: Major
              Found in src/pool.ts - About 2 hrs to fix

                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 = [];
                Severity: Minor
                Found in src/results.ts - About 2 hrs to fix

                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 {
                Severity: Minor
                Found in src/index.ts - About 1 hr to fix

                  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;
                  Severity: Minor
                  Found in src/builder.ts - About 1 hr to fix

                  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);
                  Severity: Minor
                  Found in src/index.ts - About 1 hr to fix

                    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;
                    Severity: Minor
                    Found in src/builder.ts - About 1 hr to fix

                      Function parseInner has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function parseInner(
                        series: IResponseSeries[] = [],
                        precision?: TimePrecision
                      ): IResults<any> {
                        const results: any = [];
                      Severity: Minor
                      Found in src/results.ts - About 1 hr to fix

                        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)
                        Severity: Minor
                        Found in src/results.ts - About 55 mins to fix

                        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()) {
                        Severity: Minor
                        Found in src/pool.ts - About 35 mins to fix

                        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;
                        Severity: Major
                        Found in src/builder.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return this;
                          Severity: Major
                          Found in src/builder.ts - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language