bustlelabs/shep

View on GitHub

Showing 58 of 58 total issues

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

fns.forEach((fnName) => {
  td.when(lambda.listAliases(fnName), { ignoreExtraArgs: true }).thenResolve(fnAliases[fnName])
  fnAliases[fnName].forEach(({ Name }) => {
    td.when(lambda.getEnvironment(Name, { FunctionName: fnName })).thenResolve(fnEnvs[fnName])
  })
Severity: Major
Found in test-ava/config-sync/index.js and 1 other location - About 1 day to fix
test-ava/config-sync/index-conflict.js on lines 34..41

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

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

fns.forEach((fnName) => {
  td.when(lambda.listAliases(fnName), { ignoreExtraArgs: true }).thenResolve(fnAliases[fnName])
  fnAliases[fnName].forEach(({ Name }) => {
    td.when(lambda.getEnvironment(Name, { FunctionName: fnName })).thenResolve(fnEnvs[fnName])
  })
Severity: Major
Found in test-ava/config-sync/index-conflict.js and 1 other location - About 1 day to fix
test-ava/config-sync/index.js on lines 34..41

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

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

export async function handler (opts) {
  const logger = opts.quiet ? () => {} : reporter()
  logger({ type: 'start', body: `Upload api.json to AWS` })
  try {
    await push(opts)
Severity: Major
Found in src/commands/push.js and 1 other location - About 3 hrs to fix
src/commands/build.js on lines 16..26

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

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

export async function handler (opts) {
  const logger = opts.quiet ? () => {} : reporter()
  logger({ type: 'start', body: `Build Functions` })
  try {
    await build(opts)
Severity: Major
Found in src/commands/build.js and 1 other location - About 3 hrs to fix
src/commands/push.js on lines 20..30

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

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

test('Warns on mismatch', async (t) => {
  td.when(load.pkg()).thenResolve({ devDependencies: { shep: '1.0.1' } })
  const warnings = await require('../../../src/doctor/rules/shep-version-mismatch')()
  t.is(warnings.length, 1)
})
Severity: Major
Found in test-ava/doctor/rules/shep-version-mismatch.js and 1 other location - About 2 hrs to fix
test-ava/doctor/rules/shep-version-mismatch.js on lines 16..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 84.

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

test('No warnings on matching', async (t) => {
  td.when(load.pkg()).thenResolve({ devDependencies: { shep: '1.0.0' } })
  const warnings = await require('../../../src/doctor/rules/shep-version-mismatch')()
  t.is(warnings.length, 0)
})
Severity: Major
Found in test-ava/doctor/rules/shep-version-mismatch.js and 1 other location - About 2 hrs to fix
test-ava/doctor/rules/shep-version-mismatch.js on lines 10..14

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

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

export async function updateFunction (oldFunction, wantedFunction) {
  debug('updateFunction', oldFunction, wantedFunction)
  await loadRegion()
  const lambda = new AWS.Lambda()
  const { FunctionName } = oldFunction
Severity: Major
Found in src/util/aws/lambda.js - About 2 hrs to fix

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

    function runFunction (opts) {
      require('dotenv').config()
      return async (name) => {
        const env = opts.environment || 'development'
        const performBuild = opts.build
    Severity: Minor
    Found in src/run/index.js - About 1 hr to fix

      Function default has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function (config) {
        const id = uuid.v1()
        const stream = uuid.v4().replace(/-/g, '')
      
        const timeout = config.Timeout || 10
      Severity: Minor
      Found in src/util/context.js - About 1 hr to fix

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

        export default async function ({ apiId, api: deployApi = true, functions = '*', env = 'development', region, bucket, build = true, logger = () => {} }) {
          const api = await load.api()
        
          let uploadFuncs, aliases
        
        
        Severity: Minor
        Found in src/deploy/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 handler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function handler (opts) {
          const envs = await load.envs()
          const questions = [
            {
              name: 'env',
        Severity: Minor
        Found in src/commands/config/list.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 2 locations. Consider refactoring.
        Open

        export class AWSUnexpectedLambdaState extends Error {
          constructor (additional) {
            const msg = `While updating the lambda function, the state changed before the update could be completed. ${additional}`
            super(msg)
            this.message = msg
        Severity: Major
        Found in src/util/aws/lambda.js and 1 other location - About 1 hr to fix
        src/util/aws/cloudwatch-logs.js on lines 54..61

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

        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

        export class AWSLogGroupNotFound extends Error {
          constructor (functionName) {
            const msg = `No log groups found for ${functionName}`
            super(msg)
            this.message = msg
        Severity: Major
        Found in src/util/aws/cloudwatch-logs.js and 1 other location - About 1 hr to fix
        src/util/aws/lambda.js on lines 281..288

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

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

        export function webpack () {
          return `/*
         * WARNING: Tampering with how entry is populated could affect pattern matching
         */
        
        
        Severity: Minor
        Found in src/new/templates.js - About 1 hr to fix

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

          export async function updateFunction (oldFunction, wantedFunction) {
            debug('updateFunction', oldFunction, wantedFunction)
            await loadRegion()
            const lambda = new AWS.Lambda()
            const { FunctionName } = oldFunction
          Severity: Minor
          Found in src/util/aws/lambda.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 default has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function () {
            let cur
          
            const done = (body) => {
              if (cur !== undefined) {
          Severity: Minor
          Found in src/util/reporter.js - About 1 hr to fix

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

              return yargs
              .pkgConf('shep', process.cwd())
              .boolean('quiet')
              .alias('quiet', 'q')
              .describe('quiet', 'Don\'t log anything')
            Severity: Major
            Found in src/commands/config/remove.js and 1 other location - About 1 hr to fix
            src/commands/generate/webpack.js on lines 6..12

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

            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

              return yargs
              .pkgConf('shep', process.cwd())
              .boolean('quiet')
              .alias('quiet', 'q')
              .describe('quiet', 'Don\'t log anything')
            Severity: Major
            Found in src/commands/generate/webpack.js and 1 other location - About 1 hr to fix
            src/commands/config/remove.js on lines 10..16

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

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

            export async function handler (opts) {
              const envs = await load.envs()
              const questions = [
                {
                  name: 'env',
            Severity: Minor
            Found in src/commands/config/list.js - About 1 hr to fix

              Function handler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function handler (opts) {
                const logger = opts.quiet ? () => {} : reporter()
                let envVars = {}
                opts.vars.forEach(function (varPair) {
                  const [key, value] = varPair.match(/(.*?)=(.*)/).slice(1)
              Severity: Minor
              Found in src/commands/config/set.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language