heroku/heroku-apps

View on GitHub

Showing 106 of 106 total issues

Function run has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

function * run (context, heroku) {
  const statusHelper = require('../../status_helper')
  const time = require('../../time')
  const {truncate} = require('lodash')

Severity: Minor
Found in src/commands/releases/index.js - About 1 day 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 run has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

function * run (context, heroku) {
  const filesize = require('filesize')
  const util = require('util')
  const {countBy, snakeCase} = require('lodash')

Severity: Minor
Found in src/commands/apps/info.js - About 6 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 run has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function * run (context, heroku) {
  const statusHelper = require('../../status_helper')
  const time = require('../../time')
  const {truncate} = require('lodash')

Severity: Major
Found in src/commands/releases/index.js - About 5 hrs to fix

    Function run has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    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
    Severity: Minor
    Found in src/commands/apps/index.js - About 4 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        for (let f of features) {
          let line = `${f.enabled ? '[+]' : '[ ]'} ${f.name.padEnd(longest)}`
          if (f.enabled) line = cli.color.green(line)
          line = `${line}  ${f.description}`
          cli.log(line)
    Severity: Major
    Found in src/commands/features/index.js and 1 other location - About 4 hrs to fix
    src/commands/labs/index.js on lines 15..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      for (let f of features) {
        let line = `${f.enabled ? '[+]' : '[ ]'} ${f.name.padEnd(longest)}`
        if (f.enabled) line = cli.color.green(line)
        line = `${line}  ${f.description}`
        cli.log(line)
    Severity: Major
    Found in src/commands/labs/index.js and 1 other location - About 4 hrs to fix
    src/commands/features/index.js on lines 17..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function run has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function * run (context, heroku) {
      const filesize = require('filesize')
      const util = require('util')
      const {countBy, snakeCase} = require('lodash')
    
    
    Severity: Major
    Found in src/commands/apps/info.js - About 3 hrs to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      module.exports = {
        topic: 'buildpacks',
        command: 'remove',
        args: [
          {name: 'url', optional: true}
      Severity: Major
      Found in src/commands/buildpacks/remove.js and 2 other locations - About 3 hrs to fix
      src/commands/buildpacks/add.js on lines 28..42
      src/commands/buildpacks/set.js on lines 28..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      module.exports = {
        topic: 'buildpacks',
        command: 'add',
        args: [
          {name: 'url', optional: false}
      Severity: Major
      Found in src/commands/buildpacks/add.js and 2 other locations - About 3 hrs to fix
      src/commands/buildpacks/remove.js on lines 42..56
      src/commands/buildpacks/set.js on lines 28..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      module.exports = {
        topic: 'buildpacks',
        command: 'set',
        args: [
          {name: 'url', optional: false}
      Severity: Major
      Found in src/commands/buildpacks/set.js and 2 other locations - About 3 hrs to fix
      src/commands/buildpacks/add.js on lines 28..42
      src/commands/buildpacks/remove.js on lines 42..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function run has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      async function run (context, heroku) {
        const inquirer = require('inquirer')
        function confirmPrompt (message) {
          if (process.stdin.isTTY) {
            return inquirer.prompt([{
      Severity: Minor
      Found in src/commands/keys/add.js - About 3 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 run has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      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
      Severity: Major
      Found in src/commands/apps/index.js - About 3 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          } else {
            cli.styledHeader(feature.name)
            cli.styledObject({
              Description: feature.description,
              Enabled: feature.enabled ? cli.color.green(feature.enabled) : cli.color.red(feature.enabled),
        Severity: Major
        Found in src/commands/features/info.js and 1 other location - About 3 hrs to fix
        src/commands/labs/info.js on lines 6..13

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 95.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        function print (feature) {
          cli.styledHeader(feature.name)
          cli.styledObject({
            Description: feature.description,
            Enabled: feature.enabled ? cli.color.green(feature.enabled) : cli.color.red(feature.enabled),
        Severity: Major
        Found in src/commands/labs/info.js and 1 other location - About 3 hrs to fix
        src/commands/features/info.js on lines 11..18

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 95.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function * run (context, heroku) {
          let app = context.app && !context.flags.all ? yield heroku.get(`/apps/${context.app}`) : null
          let notifications = yield heroku.request({host: 'telex.heroku.com', path: '/user/notifications'})
          if (app) notifications = notifications.filter((n) => n.target.id === app.id)
          if (!context.flags.read) {
        Severity: Minor
        Found in src/commands/notifications/index.js - About 2 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        function * run (context, heroku) {
          let app = context.app
          let p = heroku.patch(`/apps/${app}`, {body: {maintenance: false}})
          yield cli.action(`Disabling maintenance mode for ${cli.color.app(app)}`, p)
        }
        Severity: Major
        Found in src/commands/maintenance/off.js and 1 other location - About 2 hrs to fix
        src/commands/maintenance/on.js on lines 6..10

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        function * run (context, heroku) {
          let app = context.app
          let p = heroku.patch(`/apps/${app}`, {body: {maintenance: true}})
          yield cli.action(`Enabling maintenance mode for ${cli.color.app(app)}`, p)
        }
        Severity: Major
        Found in src/commands/maintenance/on.js and 1 other location - About 2 hrs to fix
        src/commands/maintenance/off.js on lines 6..10

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            yield _(yield git.listRemotes())
              .filter((r) => git.gitUrl(oldApp) === r[1] || git.sshGitUrl(oldApp) === r[1])
              .map((r) => r[0])
              .uniq()
              .map((r) => {
        Severity: Major
        Found in src/commands/apps/rename.js and 1 other location - About 2 hrs to fix
        src/commands/apps/destroy.js on lines 25..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 90.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            _(yield git.listRemotes())
              .filter((r) => git.gitUrl(app) === r[1] || git.sshGitUrl(app) === r[1])
              .map((r) => r[0])
              .uniq()
              .forEach(git.rmRemote)
        Severity: Major
        Found in src/commands/apps/destroy.js and 1 other location - About 2 hrs to fix
        src/commands/apps/rename.js on lines 25..33

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 90.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        module.exports = {
          topic: 'features',
          command: 'info',
          description: 'display information about a feature',
          args: [{name: 'feature'}],
        Severity: Major
        Found in src/commands/features/info.js and 1 other location - About 2 hrs to fix
        src/commands/labs/info.js on lines 32..43

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 89.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language