dataplug-io/dataplug-http

View on GitHub

Showing 8 of 32 total issues

File pagedHttpGetReader.ts has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright (C) 2017-2019 Brainbean Apps OU (https://brainbeanapps.com).
// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import _ from 'lodash'
import { Readable } from 'stream'
Severity: Minor
Found in src/pagedHttpGetReader.ts - About 3 hrs to fix

    Function onRequestResponse has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private onRequestResponse(response: any): void {
        logger.log(
          'debug',
          `Received response while making paged HTTP GET request to ${this.url}`,
        )
    Severity: Major
    Found in src/pagedHttpGetReader.ts - About 2 hrs to fix

      Function onRequestResponse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private onRequestResponse(response: any): void {
          logger.log(
            'debug',
            `Received response while making HTTP GET request to ${this.url}`,
          )
      Severity: Major
      Found in src/httpGetReader.ts - About 2 hrs to fix

        File httpGetReader.ts has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Copyright (C) 2017-2019 Brainbean Apps OU (https://brainbeanapps.com).
        // License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
        
        import _ from 'lodash'
        import { Readable } from 'stream'
        Severity: Minor
        Found in src/httpGetReader.ts - About 2 hrs to fix

          Function constructor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(url: string | URL, nextPage: any, options: any = undefined) {
              options = Object.assign(
                {},
                {
                  transformFactory: undefined,
          Severity: Minor
          Found in src/pagedHttpGetReader.ts - About 1 hr to fix

            Function proceedToNextPage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private proceedToNextPage(data: any): void {
                this.detachFromStreams()
            
                logger.log(
                  'verbose',
            Severity: Minor
            Found in src/pagedHttpGetReader.ts - About 1 hr to fix

              Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(url: string | URL, options: any = undefined) {
                  options = Object.assign(
                    {},
                    {
                      transform: undefined,
              Severity: Minor
              Found in src/httpGetReader.ts - About 1 hr to fix

                Function onRequestResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private onRequestResponse(response: any): void {
                    logger.log(
                      'debug',
                      `Received response while making paged HTTP GET request to ${this.url}`,
                    )
                Severity: Minor
                Found in src/pagedHttpGetReader.ts - About 25 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

                Severity
                Category
                Status
                Source
                Language