Showing 19 of 27 total issues
Function run
has 200 lines of code (exceeds 25 allowed). Consider refactoring. Open
function * run (ctx, api) {
const util = require('../../lib/util')
const table = util.table
const style = util.style
const formatPrice = util.formatPrice
Function run
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
function * run (ctx, api) {
const util = require('../../lib/util')
const table = util.table
const style = util.style
const formatPrice = util.formatPrice
- 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 displayForApp
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayForApp (app, addons) {
if (addons.length === 0) {
cli.log(`No add-ons for app ${app}.`)
return
}
Function addonGetter
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function * addonGetter (api, app) {
let attachments, addons
if (app) { // don't disploy attachments globally
addons = api.get(`/apps/${app}/addons`, {headers: {
Function displayAll
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayAll (addons) {
addons = sortBy(addons, 'app.name', 'plan.name', 'addon.name')
if (addons.length === 0) {
cli.log('No add-ons.')
Function parseConfig
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function parseConfig (args) {
let config = {}
while (args.length > 0) {
let key = args.shift()
if (!key.startsWith('--')) throw new Error(`Unexpected argument ${key}`)
- 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 attachment
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.attachment = function (heroku, app, id, options = {}) {
const headers = attachmentHeaders()
function getAttachment (id) {
return heroku.post('/actions/addon-attachments/resolve', {
Function run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function * run (context, heroku) {
const util = require('../../lib/util')
let app = context.app
let addon = yield heroku.get(`/addons/${encodeURIComponent(context.args.addon_name)}`)
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function * (heroku, app, plan, confirm, wait, options) {
const util = require('./util')
const waitForAddonProvisioning = require('./addons_wait')
function createAddonRequest (confirm) {
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function * run (context, heroku) {
const util = require('../../lib/util')
let app = context.app
let addon = yield heroku.get(`/addons/${encodeURIComponent(context.args.addon_name)}`)
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function * run (ctx, api) {
const resolve = require('../../lib/resolve')
let addons
if (ctx.args.addon) {
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function * run (c, h) {
const resolver = require('../../lib/resolve')
const util = require('../../lib/util')
context = c
Function writeSudoTemplate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function writeSudoTemplate (ctx, sso, path) {
return new Promise(function (resolve, reject) {
let html = `<!DOCTYPE HTML>
<html>
<head>
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function * run (context, heroku) {
const resolve = require('../../lib/resolve')
const {groupBy, toPairs} = require('lodash')
let force = context.flags.force || process.env.HEROKU_FORCE === '1'
- 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 exports
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function * (heroku, app, plan, confirm, wait, options) {
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function * (heroku, app, plan, confirm, wait, options) {
const util = require('./util')
const waitForAddonProvisioning = require('./addons_wait')
function createAddonRequest (confirm) {
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function * run (ctx, api) {
const resolve = require('../../lib/resolve')
if (process.env.HEROKU_SUDO) return sudo(ctx, api)
- 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 handleAPIError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function handleAPIError (err) {
if (err.statusCode === 422 && err.body.id === 'multiple_matches') {
let example = err.body.message.split(', ')[2] || 'redis-triangular-1234'
throw new Error(`${err.body.message}
- 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 filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const filter = function (app, addonService) {
return attachments => {
return attachments.filter(attachment => {
if (attachment.app.name !== app) {
return false
- 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"