heroku/heroku-cli-addons

View on GitHub
commands/addons/index.js

Summary

Maintainability
D
2 days
Test Coverage

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
Severity: Major
Found in commands/addons/index.js - About 1 day to fix

    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
    Severity: Minor
    Found in commands/addons/index.js - About 7 hrs 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 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
        }
    Severity: Major
    Found in commands/addons/index.js - About 2 hrs to fix

      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: {
      Severity: Major
      Found in commands/addons/index.js - About 2 hrs to fix

        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.')
        Severity: Minor
        Found in commands/addons/index.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status