prescottprue/fireadmin

View on GitHub

Showing 76 of 224 total issues

File actionRunner.spec.ts has 784 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import 'mocha'
import * as admin from 'firebase-admin'
import fs from 'fs'
import { expect } from 'chai'
import * as sinon from 'sinon'
Severity: Major
Found in functions/src/actionRunner/actionRunner.spec.ts - About 1 day to fix

    Function ActionTemplateSteps has 159 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ActionTemplateSteps() {
      const classes = useStyles()
      const { control, register, watch } = useFormContext()
      const name = 'steps'
      const { fields, remove, append } = useFieldArray({ control, name })

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

      function ActionTemplateBackups() {
        const classes = useStyles()
        const { control, register, watch } = useFormContext()
        const name = 'backups'
        const { fields, remove, append } = useFieldArray({ control, name })

        Function HomePage has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function HomePage() {
          const classes = useStyles()
        
          return (
            <Grid container spacing={8} justify="center" className={classes.root}>
        Severity: Major
        Found in src/routes/Home/components/HomePage/HomePage.js - About 3 hrs to fix

          File utils.ts has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as admin from 'firebase-admin'
          import fetch from 'node-fetch'
          import { omit } from 'lodash'
          import { PROJECTS_COLLECTION } from '../constants/firebasePaths'
          import {
          Severity: Minor
          Found in functions/src/actionRunner/utils.ts - About 3 hrs to fix

            Function ActionTemplateInputs has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function ActionTemplateInputs() {
              const classes = useStyles()
              const { control, register, watch } = useFormContext()
              const name = 'inputs'
              const { fields, remove, append } = useFieldArray({ control, name })

              Function ActionTemplateEnvs has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function ActionTemplateEnvs() {
                const classes = useStyles()
                const { control, register, watch } = useFormContext()
                const name = 'environments'
                const { fields, remove, append } = useFieldArray({ control, name })

                File runSteps.ts has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import * as functions from 'firebase-functions'
                import * as admin from 'firebase-admin'
                import { map } from 'lodash'
                import {
                  copyFromRTDBToFirestore,
                Severity: Minor
                Found in functions/src/actionRunner/runSteps.ts - About 3 hrs to fix

                  Function callGoogleApi has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default async function callGoogleApi(
                    snap: admin.database.DataSnapshot,
                    context: functions.EventContext
                  ): Promise<any> {
                    const eventVal = snap.val()
                  Severity: Major
                  Found in functions/src/callGoogleApi/callGoogleApi.ts - About 3 hrs to fix

                    Function ActionTemplatesList has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ActionTemplatesList() {
                      const classes = useStyles()
                      const {
                        user,
                        toggleNewDialog,

                      Function runAction has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async function runAction(formValues) {
                          const { environmentValues } = formValues
                          const selectedEnvironments = map(
                            environmentValues,
                            (envKey) => environmentsById[envKey]

                        Function BucketConfigForm has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function BucketConfigForm({ projectId }) {
                          const classes = useStyles()
                          const methods = useForm({
                            defaultValues: { body: { cors: [{ origin: ['*'] }] } }
                          })

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

                        function useActionTemplatesList() {
                          const { showSuccess, showError } = useNotifications()
                        
                          // State
                          const [newDialogOpen, changeDialogState] = useState(false)

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

                          export async function runStep({
                            inputs,
                            convertedInputValues,
                            convertedEnvs,
                            step,
                          Severity: Minor
                          Found in functions/src/actionRunner/runSteps.ts - 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

                          File RolesTableRow.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { useState } from 'react'
                          import PropTypes from 'prop-types'
                          import { startCase } from 'lodash'
                          import { useForm } from 'react-hook-form'
                          import Button from '@material-ui/core/Button'

                            Function runAction has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default async function runAction(
                              snap: admin.database.DataSnapshot,
                              context: functions.EventContext
                            ): Promise<null> {
                              const eventData = snap.val() || {}
                            Severity: Major
                            Found in functions/src/actionRunner/runAction.ts - About 2 hrs to fix

                              Function useEnvironmentsPage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function useEnvironmentsPage({ projectId }) {
                                const { showError, showSuccess } = useNotifications()
                              
                                // State
                                const [newDialogOpen, changeNewDialogOpen] = useState(false)

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

                              function LoginPage() {
                                const classes = useStyles()
                                const auth = useAuth()
                                const firestore = useFirestore()
                                const { showError } = useNotifications()
                              Severity: Major
                              Found in src/routes/Login/components/LoginPage/LoginPage.js - About 2 hrs to fix

                                Function useSetupMessaging has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function useSetupMessaging() {
                                  const messaging = useMessaging()
                                  const analytics = useAnalytics()
                                  const firestore = useFirestore()
                                  const { FieldValue } = useFirestore
                                Severity: Major
                                Found in src/components/SetupMessaging/useSetupMessaging.js - About 2 hrs to fix

                                  Function createValidActionRunnerStubs has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function createValidActionRunnerStubs(opts?: any) {
                                        const {
                                          projectId = 'asdfasdf1',
                                          srcResource = 'rtdb',
                                          destResource = 'rtdb',
                                  Severity: Major
                                  Found in functions/src/actionRunner/actionRunner.spec.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language