heroku/heroku-pg

View on GitHub

Showing 51 of 99 total issues

Function exports has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (context, heroku) => ({
  filesize: (size, opts = {}) => {
    Object.assign(opts, {
      decimalPlaces: 2,
      fixedDecimals: true
Severity: Minor
Found in lib/pgbackups.js - About 1 day 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 run has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

async function run (context, heroku) {
  const debug = require('debug')('heroku-pg')
  const fetcher = require('../lib/fetcher')(heroku)
  const host = require('../lib/host')
  const app = context.app
Severity: Minor
Found in commands/wait.js - About 4 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 run has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

function * run (context, heroku) {
  const fetcher = require('../lib/fetcher')(heroku)
  const host = require('../lib/host')
  const util = require('../lib/util')
  const {app, args} = context
Severity: Minor
Found in commands/diagnose.js - About 4 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 exports has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = heroku => {
  function * attachment (app, passedDb, namespace = null) {
    let db = passedDb || 'DATABASE_URL'

    function matchesHelper (app, db) {
Severity: Major
Found in lib/fetcher.js - About 4 hrs to fix

    Function exports has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = heroku => {
      function * attachment (app, passedDb, namespace = null) {
        let db = passedDb || 'DATABASE_URL'
    
        function matchesHelper (app, db) {
    Severity: Minor
    Found in lib/fetcher.js - About 3 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 run has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function * run (context, heroku) {
      const fetcher = require('../lib/fetcher')(heroku)
      const {app, args} = context
      const attachment = yield fetcher.attachment(app, args.database)
      let current
    Severity: Major
    Found in commands/promote.js - About 3 hrs to fix

      Function list has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function * list (context, heroku) {
        const pgbackups = require('../../lib/pgbackups')(context, heroku)
        const {sortBy} = require('lodash')
        const host = require('../../lib/host')()
        const app = context.app
      Severity: Major
      Found in commands/backups/index.js - About 2 hrs to fix

        Function run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        function * run (context, heroku) {
          const pgbackups = require('../../lib/pgbackups')(context, heroku)
          const fetcher = require('../../lib/fetcher')(heroku)
          const host = require('../../lib/host')
          const {sortBy} = require('lodash')
        Severity: Minor
        Found in commands/backups/restore.js - 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 run has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function run (context, heroku) {
          const debug = require('debug')('heroku-pg')
          const fetcher = require('../lib/fetcher')(heroku)
          const host = require('../lib/host')
          const app = context.app
        Severity: Major
        Found in commands/wait.js - About 2 hrs to fix

          Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function * run (context, heroku) {
            const url = require('url')
            const host = require('../lib/host')
            const pgbackups = require('../lib/pgbackups')(context, heroku)
            const fetcher = require('../lib/fetcher')(heroku)
          Severity: Minor
          Found in commands/copy.js - 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 run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function * run (context, heroku) {
            const url = require('url')
            const host = require('../lib/host')
            const pgbackups = require('../lib/pgbackups')(context, heroku)
            const fetcher = require('../lib/fetcher')(heroku)
          Severity: Major
          Found in commands/copy.js - About 2 hrs to fix

            Function run has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function * run (context, heroku) {
              const fetcher = require('../lib/fetcher')(heroku)
              const host = require('../lib/host')
              const util = require('../lib/util')
              const {app, args} = context
            Severity: Major
            Found in commands/diagnose.js - About 2 hrs to fix

              Function wait has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                wait: (action, transferID, interval, verbose, app) => {
                  if (app === undefined) {
                    app = context.app
                  }
                  const wait = require('co-wait')
              Severity: Major
              Found in lib/pgbackups.js - About 2 hrs to fix

                Function run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function * run (context, heroku) {
                  const pgbackups = require('../../lib/pgbackups')(context, heroku)
                  const {sortBy} = require('lodash')
                  const host = require('../../lib/host')()
                  const app = context.app
                Severity: Minor
                Found in commands/backups/info.js - 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 run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function * run (context, heroku) {
                  const host = require('../../lib/host')
                  const fetcher = require('../../lib/fetcher')(heroku)
                  const util = require('../../lib/util')
                  const {app, args, flags} = context
                Severity: Minor
                Found in commands/credentials/rotate.js - 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 attachment has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function * attachment (app, passedDb, namespace = null) {
                    let db = passedDb || 'DATABASE_URL'
                
                    function matchesHelper (app, db) {
                      const {resolve} = require('@heroku-cli/plugin-addons')
                Severity: Minor
                Found in lib/fetcher.js - About 2 hrs to fix

                  Function waitFor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    let waitFor = async function waitFor (db) {
                      let interval = parseInt(context.flags['wait-interval'])
                      if (!interval || interval < 0) interval = 5
                  
                      let status
                  Severity: Minor
                  Found in commands/wait.js - About 1 hr to fix

                    Function run has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function * run (context, heroku) {
                      const host = require('../../lib/host')
                      const fetcher = require('../../lib/fetcher')(heroku)
                      const util = require('../../lib/util')
                      const {app, args, flags} = context
                    Severity: Minor
                    Found in commands/credentials/rotate.js - About 1 hr to fix

                      Function run has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function * run (context, heroku) {
                        const pgbackups = require('../../lib/pgbackups')(context, heroku)
                        const fetcher = require('../../lib/fetcher')(heroku)
                        const host = require('../../lib/host')
                        const {sortBy} = require('lodash')
                      Severity: Minor
                      Found in commands/backups/restore.js - About 1 hr to fix

                        Function run has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function * run (context, heroku) {
                          const pgbackups = require('../../lib/pgbackups')(context, heroku)
                          const fetcher = require('../../lib/fetcher')(heroku)
                          const host = require('../../lib/host')
                        
                        
                        Severity: Minor
                        Found in commands/backups/capture.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language