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

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

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

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 too many return statements within this function.
Open

        return 'Pending'
Severity: Major
Found in lib/pgbackups.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

      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

        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

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

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

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

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

        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

        Severity
        Category
        Status
        Source
        Language