commands/addons/index.js
Function run
has 200 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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
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
Open
function displayAll (addons) {
addons = sortBy(addons, 'app.name', 'plan.name', 'addon.name')
if (addons.length === 0) {
cli.log('No add-ons.')