heroku/heroku-pg

View on GitHub

Showing 51 of 99 total issues

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

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

Avoid too many return statements within this function.
Open

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

    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 lib/pgbackups.js - About 30 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 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 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 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')
         
        const {app, args, flags} = context
        const {database} = args
        Severity: Minor
        Found in commands/outliers.js - About 25 mins to fix
        Severity
        Category
        Status
        Source
        Language