bustlelabs/shep

View on GitHub

Showing 14 of 58 total issues

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

        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

            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

                Function environmentCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function environmentCheck (envs) {
                  const extractedEnvs = values(envs)
                
                  return Object.keys(envs).reduce(({ common, differences, conflicts }, func) => {
                    const env = envs[func]
                Severity: Minor
                Found in src/util/environment-check.js - About 1 hr to fix

                  Function addPath has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function addPath (api, path, method, accountId, functionName, region = 'us-east-1') {
                  Severity: Minor
                  Found in src/generate-endpoint/index.js - About 45 mins to fix

                    Function deploy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export async function deploy (id, env, attempts = 1) {
                      await loadRegion()
                      const apiGateway = new AWS.APIGateway()
                    
                      try {
                    Severity: Minor
                    Found in src/util/aws/api-gateway.js - About 35 mins 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 formatResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function formatResponse ({ result, response }) {
                      if (response) {
                        if (result === results.success) {
                          return JSON.stringify(response)
                        } else if (result === results.error) {
                    Severity: Minor
                    Found in src/run/index.js - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language