heroku/heroku-pg

View on GitHub

Showing 99 of 99 total issues

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

yield cli.action(`Setting maintenance window for ${cli.color.addon(db.name)} to ${cli.color.cyan(args.window)}`, co(function * () {
Severity: Major
Found in commands/maintenance/window.js and 3 other locations - About 35 mins to fix
commands/copy.js on lines 59..59
commands/links/create.js on lines 23..23
commands/links/destroy.js on lines 18..18

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

yield cli.action(`Destroying link ${cli.color.cyan(args.link)} from ${cli.color.addon(db.name)}`, co(function * () {
Severity: Major
Found in commands/links/destroy.js and 3 other locations - About 35 mins to fix
commands/copy.js on lines 59..59
commands/links/create.js on lines 23..23
commands/maintenance/window.js on lines 17..17

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

yield cli.action(`Starting copy of ${cli.color.yellow(source.name)} to ${cli.color.yellow(target.name)}`, co(function * () {
Severity: Major
Found in commands/copy.js and 3 other locations - About 35 mins to fix
commands/links/create.js on lines 23..23
commands/links/destroy.js on lines 18..18
commands/maintenance/window.js on lines 17..17

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

yield cli.action(`Adding link from ${cli.color.addon(target.name)} to ${cli.color.addon(db.name)}`, co(function * () {
Severity: Major
Found in commands/links/create.js and 3 other locations - About 35 mins to fix
commands/copy.js on lines 59..59
commands/links/destroy.js on lines 18..18
commands/maintenance/window.js on lines 17..17

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

cli.log(`${name.replace(/_/g, '-')} is set to ${setting.value} for ${db.name}.`)
Severity: Minor
Found in lib/setter.js and 1 other location - About 30 mins to fix
lib/setter.js on lines 53..53

Avoid too many return statements within this function.
Open

if (backup.started_at) return 'Running'
Severity: Major
Found in commands/backups/info.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

    return 'Pending'
    Severity: Major
    Found in commands/backups/info.js - About 30 mins to fix

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

      cli.log(`${name.replace(/_/g, '-')} has been set to ${setting.value} for ${db.name}.`)
      Severity: Minor
      Found in lib/setter.js and 1 other location - About 30 mins to fix
      lib/setter.js on lines 45..45

      Avoid too many return statements within this function.
      Open

      return 'Pending'
      Severity: Major
      Found in lib/pgbackups.js - About 30 mins to fix

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

        if (!backup.succeeded) throw new Error(`Backup ${cli.color.cyan(backupName)} for ${cli.color.app(backupApp)} did not complete successfully`)
        Severity: Minor
        Found in commands/backups/restore.js and 1 other location - About 30 mins to fix
        commands/backups/restore.js on lines 44..44

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

        if (!backup) throw new Error(`Backup ${cli.color.cyan(backupName)} not found for ${cli.color.app(backupApp)}`)
        Severity: Minor
        Found in commands/backups/restore.js and 1 other location - About 30 mins to fix
        commands/backups/restore.js on lines 45..45

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

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

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

        function status (backup) {
        if (backup.succeeded) {
        if (backup.warnings > 0) return `Finished with ${backup.warnings} warnings`
        else return 'Completed'
        }
        Severity: Minor
        Found in commands/backups/info.js - About 25 mins to fix

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

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

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

        function parseURL (db) {
        const url = require('url')
        db = url.parse(db.match(/:\/\//) ? db : `postgres:///${db}`)
        let [user, password] = db.auth ? db.auth.split(':') : []
        db.user = user
        Severity: Minor
        Found in commands/pull.js - About 25 mins to fix

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

        function * run (context, heroku) {
        const fetcher = require('../lib/fetcher')
         
        const {app, args, flags} = context
        const {database} = args
        Severity: Minor
        Found in commands/outliers.js - About 25 mins to fix

        TODO found
        Open

        // TODO: it shouldn't matter if the target has *more* extensions than the source
        Severity: Minor
        Found in commands/pull.js by fixme

        TODO found
        Open

        // TODO defend against side effects, should find altering code & fix
        Severity: Minor
        Found in commands/pull.js by fixme

        TODO found
        Open

        // TODO: util.getConfigVarName is only providing one of config vars of that
        Severity: Minor
        Found in commands/diagnose.js by fixme
        Severity
        Category
        Status
        Source
        Language