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
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
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',
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')
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
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
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
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
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 {
- Read upRead up
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
- Read upRead up
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
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')
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')
- Read upRead up
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) {
- Read upRead up
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
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 => {
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://')
})
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(', '))
- Read upRead up
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.')
}
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.`
}