heroku/heroku-apps

View on GitHub

Showing 106 of 106 total issues

Function exports has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (context) {
  let sshGitUrl = (app) => `git@${context.gitHost}:${app}.git`
  let gitUrl = (app) => `https://${context.httpGitHost}/${app}.git`

  function git (args) {
Severity: Minor
Found in src/git.js - About 1 hr to fix

    Function printDynos has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function printDynos (dynos) {
      let dynosByCommand = reduce(dynos, function (dynosByCommand, dyno) {
        let since = time.ago(new Date(dyno.updated_at))
        let size = dyno.size || '1X'
    
    
    Severity: Minor
    Found in src/commands/ps/index.js - About 1 hr 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 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function * run (context, heroku) {
      if (context.args.length === 0) {
        cli.exit(1, 'Usage: heroku config:set KEY1=VALUE1 [KEY2=VALUE2 ...]\nMust specify KEY and VALUE to set.')
      }
    
    
    Severity: Minor
    Found in src/commands/config/set.js - About 1 hr to fix

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

      let cmd = {
        description: 'unset one or more config vars',
        examples: `$ heroku config:unset RAILS_ENV
      Unsetting RAILS_ENV and restarting example... done, v10
      
      
      Severity: Major
      Found in src/commands/config/unset.js and 1 other location - About 1 hr to fix
      src/commands/config/set.js on lines 54..68

      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 66.

      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

      let cmd = {
        description: 'set one or more config vars',
        examples: `$ heroku config:set RAILS_ENV=staging
      Setting config vars and restarting example... done, v10
      RAILS_ENV: staging
      Severity: Major
      Found in src/commands/config/set.js and 1 other location - About 1 hr to fix
      src/commands/config/unset.js on lines 37..48

      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 66.

      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 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function * run (context, heroku) {
        let app = context.app
      
        function parse (args) {
          return compact(args.map((arg) => {
      Severity: Minor
      Found in src/commands/ps/scale.js - About 1 hr to fix

        Function optimizeWidth has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          let optimizeWidth = function (releases, columns, optimizeKey) {
            for (let col of columns) {
              col.optimizationWidth = 0
            }
        
        
        Severity: Minor
        Found in src/commands/releases/index.js - About 1 hr to fix

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

          function * run (context, heroku) {
            const {app, flags, args} = context
            const types = args
            const {json, extended} = flags
            const suffix = extended ? '?extended=true' : ''
          Severity: Minor
          Found in src/commands/ps/index.js - About 1 hr 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 printAccountQuota has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function * printAccountQuota (context, heroku, app, account) {
            if (app.process_tier !== 'free') {
              return
            }
          
          
          Severity: Minor
          Found in src/commands/ps/index.js - About 1 hr to fix

            Function print has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function print () {
                let data = {}
                data.Addons = addons
                data.Collaborators = collaborators
            
            
            Severity: Minor
            Found in src/commands/apps/info.js - About 1 hr to fix

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

              function * run (context, heroku) {
                let app = context.app
              
                let parse = co.wrap(function * (args) {
                  if (args.length === 0) return []
              Severity: Minor
              Found in src/commands/ps/type.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function * run (context, heroku) {
                const {sum, fromPairs} = require('lodash')
              
                const hours = parseInt(context.flags.hours) || 24
                const NOW = new Date().toISOString()
              Severity: Minor
              Found in src/commands/apps/errors.js - About 1 hr 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 3 locations. Consider refactoring.
              Open

              module.exports = [
                Object.assign({topic: 'apps', command: 'stacks:set'}, cmd),
                Object.assign({topic: 'stack', command: 'set', hidden: true}, cmd)
              ]
              Severity: Major
              Found in src/commands/apps/stacks/set.js and 2 other locations - About 1 hr to fix
              src/commands/config/set.js on lines 70..73
              src/commands/config/unset.js on lines 50..53

              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 59.

              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 = [
                Object.assign({topic: 'config', command: 'unset'}, cmd),
                Object.assign({topic: 'config', command: 'remove', hidden: true}, cmd)
              ]
              Severity: Major
              Found in src/commands/config/unset.js and 2 other locations - About 1 hr to fix
              src/commands/apps/stacks/set.js on lines 33..36
              src/commands/config/set.js on lines 70..73

              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 59.

              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 findKey has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                let findKey = async function () {
                  const defaultKey = path.join(sshdir, 'id_rsa.pub')
                  if (!(await fs.pathExists(defaultKey))) {
                    cli.console.error('Could not find an existing SSH key at ~/.ssh/id_rsa.pub')
              
              
              Severity: Minor
              Found in src/commands/keys/add.js - About 1 hr to fix

                Function run has 30 lines of code (exceeds 25 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 1 hr to fix

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

                  module.exports = [
                    Object.assign({topic: 'config', command: 'set'}, cmd),
                    Object.assign({topic: 'config', command: 'add', hidden: true}, cmd)
                  ]
                  Severity: Major
                  Found in src/commands/config/set.js and 2 other locations - About 1 hr to fix
                  src/commands/apps/stacks/set.js on lines 33..36
                  src/commands/config/unset.js on lines 50..53

                  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 59.

                  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 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function * run (context, heroku) {
                    const shellescape = require('shell-escape')
                    const statusHelper = require('../../status_helper')
                    const {forEach} = require('lodash')
                  
                  
                  Severity: Minor
                  Found in src/commands/releases/info.js - About 1 hr to fix

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

                    module.exports = {
                      topic: 'maintenance',
                      command: 'on',
                      description: 'put the app into maintenance mode',
                      needsApp: true,
                    Severity: Major
                    Found in src/commands/maintenance/on.js and 3 other locations - About 1 hr to fix
                    src/commands/apps/favorites/add.js on lines 21..28
                    src/commands/apps/favorites/remove.js on lines 21..28
                    src/commands/maintenance/off.js on lines 12..19

                    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 58.

                    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 4 locations. Consider refactoring.
                    Open

                    module.exports = {
                      topic: 'apps',
                      command: 'favorites:add',
                      description: 'favorites an app',
                      needsAuth: true,
                    Severity: Major
                    Found in src/commands/apps/favorites/add.js and 3 other locations - About 1 hr to fix
                    src/commands/apps/favorites/remove.js on lines 21..28
                    src/commands/maintenance/off.js on lines 12..19
                    src/commands/maintenance/on.js on lines 12..19

                    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 58.

                    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