heroku/heroku-pg

View on GitHub

Showing 51 of 99 total issues

Function run has 40 lines of code (exceeds 25 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 1 hr to fix

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

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

      Function presentCredentialAttachments has 36 lines of code (exceeds 25 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 1 hr to fix

        Function run has 35 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')
        
        
        Severity: Minor
        Found in commands/credentials/url.js - About 1 hr to fix

          Function run has 34 lines of code (exceeds 25 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 1 hr to fix

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

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

              Function poll has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  let poll = co.wrap(function * () {
                    let tty = process.env.TERM !== 'dumb' && process.stderr.isTTY
                    let backup
                    let failures = 0
              
              
              Severity: Minor
              Found in lib/pgbackups.js - About 1 hr to fix

                Function run has 32 lines of code (exceeds 25 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 1 hr to fix

                  Function prefix has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function prefix (transfer) {
                    if (transfer.from_type === 'pg_dump') {
                      if (transfer.to_type === 'pg_restore') {
                        return 'c'
                      } else {
                  Severity: Minor
                  Found in lib/pgbackups.js - About 1 hr 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 list has a Cognitive Complexity of 11 (exceeds 5 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: Minor
                  Found in commands/backups/index.js - About 1 hr 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 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 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

                      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 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

                      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 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 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 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 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

                            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

                            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

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language