heroku/heroku-pg

View on GitHub

Showing 99 of 99 total issues

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

Object.assign({
command: 'push',
description: 'push local or remote into Heroku database',
help: `Push from SOURCE into TARGET. TARGET must be empty.
 
 
Severity: Major
Found in commands/pull.js and 1 other location - About 1 hr to fix
commands/pull.js on lines 207..229

Function run has 29 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 {app, args, flags} = context
Severity: Minor
Found in commands/backups/schedule.js - About 1 hr to fix

    Function download has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function download (url, path, opts) {
    const progress = require('smooth-progress')
    const bytes = require('bytes')
    const https = require('https')
    const fs = require('fs')
    Severity: Minor
    Found in lib/download.js - About 1 hr to fix

      Function configVarNamesFromValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.configVarNamesFromValue = (config, value) => {
      let keys = []
      for (let key of Object.keys(config)) {
      let configVal = config[key]
      if (configVal === value) {
      Severity: Minor
      Found in lib/util.js - About 1 hr to fix

      Function run has a Cognitive Complexity of 10 (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')
       
       
      Severity: Minor
      Found in commands/backups/capture.js - About 1 hr to fix

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

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

        Function getConnectionDetails has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.getConnectionDetails = function (attachment, config) {
        const url = require('url')
        const configVars = attachment.config_vars.filter((cv) => {
        return config[cv] && config[cv].startsWith('postgres://')
        })
        Severity: Minor
        Found in lib/util.js - About 1 hr to fix

          Function displayReport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          let displayReport = report => {
          cli.log(`Report ${report.id} for ${report.app}::${report.database}
          available for one month after creation on ${report.created_at}
          `)
          let display = checks => {
          Severity: Minor
          Found in commands/diagnose.js - About 1 hr to fix

            Function displayDB has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function displayDB (db, app) {
            if (db.addon.attachment_names) {
            cli.styledHeader(db.addon.attachment_names.map(c => cli.color.configVar(c + '_URL')).join(', '))
            } else {
            cli.styledHeader(db.configVars.map(c => cli.color.configVar(c)).join(', '))
            Severity: Minor
            Found in commands/info.js - About 55 mins to fix

            Avoid deeply nested control flow statements.
            Open

            if (detach && detach.status === 'succeeded') {
            msg += 'without an attached DATABASE_URL.'
            } else {
            msg += `with ${current.addon.name} attached as DATABASE_URL.`
            }
            Severity: Major
            Found in commands/promote.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

              } else if (Date.now() > endTime) {
              return cli.action.done('timeout. Check your Attach DATABASE release for failures.')
              }
              Severity: Major
              Found in commands/promote.js - About 45 mins to fix

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

                cli.warn(`${cli.color.cmd('pg:credentials')} has recently changed. Please use ${cli.color.cmd('pg:credentials:url')} for the previous output.`)
                Severity: Major
                Found in commands/credentials.js and 3 other locations - About 40 mins to fix
                commands/backups/capture.js on lines 39..43
                commands/backups/restore.js on lines 62..66
                commands/credentials.js on lines 45..45

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

                cli.error(`${cli.color.cmd('pg:credentials --reset')} is deprecated. Please use ${cli.color.cmd('pg:credentials:rotate')} instead.`)
                Severity: Major
                Found in commands/credentials.js and 3 other locations - About 40 mins to fix
                commands/backups/capture.js on lines 39..43
                commands/backups/restore.js on lines 62..66
                commands/credentials.js on lines 35..35

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

                yield cli.confirmApp(app, flags.confirm, `WARNING: Destructive action
                ${cli.color.addon(db.name)} will become writeable and no longer follow ${origin}. This cannot be undone.
                `)
                Severity: Minor
                Found in commands/unfollow.js and 1 other location - About 40 mins to fix
                commands/upgrade.js on lines 28..31

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

                cli.log(`
                Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
                Use ${cli.color.cmd('heroku pg:backups:info')} to check progress.
                Stop a running backup with ${cli.color.cmd('heroku pg:backups:cancel')}.
                `)
                Severity: Major
                Found in commands/backups/capture.js and 3 other locations - About 40 mins to fix
                commands/backups/restore.js on lines 62..66
                commands/credentials.js on lines 35..35
                commands/credentials.js on lines 45..45

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

                cli.log(`
                Use Ctrl-C at any time to stop monitoring progress; the backup will continue restoring.
                Use ${cli.color.cmd('heroku pg:backups')} to check progress.
                Stop a running restore with ${cli.color.cmd('heroku pg:backups:cancel')}.
                `)
                Severity: Major
                Found in commands/backups/restore.js and 3 other locations - About 40 mins to fix
                commands/backups/capture.js on lines 39..43
                commands/credentials.js on lines 35..35
                commands/credentials.js on lines 45..45

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

                yield cli.confirmApp(app, flags.confirm, `WARNING: Destructive action
                ${cli.color.addon(db.name)} will be upgraded to a newer PostgreSQL version, stop following ${origin}, and become writable.
                 
                This cannot be undone.`)
                Severity: Minor
                Found in commands/upgrade.js and 1 other location - About 40 mins to fix
                commands/unfollow.js on lines 18..20

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

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

                Function presentCredentialAttachments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function presentCredentialAttachments (app, credAttachments, credentials, cred) {
                let isForeignApp = (attOrAddon) => attOrAddon.app.name !== app
                let atts = sortBy(credAttachments,
                isForeignApp,
                'name',
                Severity: Minor
                Found in lib/util.js - About 35 mins to fix

                Function generate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.generate = (name, convert, explain) => {
                return co.wrap(function * run (context, heroku) {
                const host = require('./host')
                const util = require('./util')
                const fetcher = require('./fetcher')(heroku)
                Severity: Minor
                Found in lib/setter.js - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language