bencevans/node-influx

View on GitHub

Showing 34 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      public alterRetentionPolicy(
        name: string,
        options: IRetentionOptions
      ): Promise<void> {
        const q =
    Severity: Major
    Found in src/index.ts and 1 other location - About 7 hrs to fix
    src/index.ts on lines 1016..1030

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      public createRetentionPolicy(
        name: string,
        options: IRetentionOptions
      ): Promise<void> {
        const q =
    Severity: Major
    Found in src/index.ts and 1 other location - About 7 hrs to fix
    src/index.ts on lines 1054..1068

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      public dropRetentionPolicy(
        name: string,
        database: string = this._defaultDB()
      ): Promise<void> {
        return this._pool
    Severity: Major
    Found in src/index.ts and 1 other location - About 5 hrs to fix
    src/index.ts on lines 974..991

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      public dropContinuousQuery(
        name: string,
        database: string = this._defaultDB()
      ): Promise<void> {
        return this._pool
    Severity: Major
    Found in src/index.ts and 1 other location - About 5 hrs to fix
    src/index.ts on lines 1082..1099

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          '"' +
          leftPad(date.getUTCFullYear(), 2) +
          "-" +
          leftPad(date.getUTCMonth() + 1, 2) +
          "-" +
    Severity: Major
    Found in src/grammar/times.ts and 1 other location - About 4 hrs to fix
    src/grammar/times.ts on lines 289..302

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          '"' +
          leftPad(date.getUTCFullYear(), 2) +
          "-" +
          leftPad(date.getUTCMonth() + 1, 2) +
          "-" +
    Severity: Major
    Found in src/grammar/times.ts and 1 other location - About 4 hrs to fix
    src/grammar/times.ts on lines 125..138

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          public revokeAdminPrivilege(username: string): Promise<void> {
            return this._pool
              .json(
                this._getQueryOpts(
                  {
        Severity: Major
        Found in src/index.ts and 4 other locations - About 3 hrs to fix
        src/index.ts on lines 516..528
        src/index.ts on lines 537..549
        src/index.ts on lines 846..858
        src/index.ts on lines 888..900

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 97.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          public dropDatabase(databaseName: string): Promise<void> {
            return this._pool
              .json(
                this._getQueryOpts(
                  {
        Severity: Major
        Found in src/index.ts and 4 other locations - About 3 hrs to fix
        src/index.ts on lines 516..528
        src/index.ts on lines 846..858
        src/index.ts on lines 867..879
        src/index.ts on lines 888..900

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 97.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          public grantAdminPrivilege(username: string): Promise<void> {
            return this._pool
              .json(
                this._getQueryOpts(
                  {
        Severity: Major
        Found in src/index.ts and 4 other locations - About 3 hrs to fix
        src/index.ts on lines 516..528
        src/index.ts on lines 537..549
        src/index.ts on lines 867..879
        src/index.ts on lines 888..900

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 97.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          public dropUser(username: string): Promise<void> {
            return this._pool
              .json(
                this._getQueryOpts(
                  {
        Severity: Major
        Found in src/index.ts and 4 other locations - About 3 hrs to fix
        src/index.ts on lines 516..528
        src/index.ts on lines 537..549
        src/index.ts on lines 846..858
        src/index.ts on lines 867..879

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 97.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          public createDatabase(databaseName: string): Promise<void> {
            return this._pool
              .json(
                this._getQueryOpts(
                  {
        Severity: Major
        Found in src/index.ts and 4 other locations - About 3 hrs to fix
        src/index.ts on lines 537..549
        src/index.ts on lines 846..858
        src/index.ts on lines 867..879
        src/index.ts on lines 888..900

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 97.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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
                  Severity
                  Category
                  Status
                  Source
                  Language