src/commands/apps/index.js
Function run
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
Open
function * run (context, heroku) {
const {sortBy, partition} = require('lodash')
let team = context.org || context.team || context.flags.team
let org = (!context.flags.personal && team) ? team : null
- 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 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function * run (context, heroku) {
const {sortBy, partition} = require('lodash')
let team = context.org || context.team || context.flags.team
let org = (!context.flags.personal && team) ? team : null
Function print
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function print (apps, user) {
if (apps.length === 0) {
if (space) cli.log(`There are no apps in space ${cli.color.green(space)}.`)
else if (org) cli.log(`There are no apps in team ${cli.color.magenta(org)}.`)
else cli.log('You have no apps.')