prescottprue/fireadmin

View on GitHub

Showing 224 of 224 total issues

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 })

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

        const fakeEvent = {
          ref: {
            listCollections: () =>
              Promise.resolve([
                {
    Severity: Major
    Found in functions/src/cleanupProject/cleanupProject.spec.ts and 1 other location - About 3 hrs to fix
    functions/src/cleanupProject/cleanupProject.spec.ts on lines 158..174

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

    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

        const fakeEvent = {
          ref: {
            listCollections: () =>
              Promise.resolve([
                {
    Severity: Major
    Found in functions/src/cleanupProject/cleanupProject.spec.ts and 1 other location - About 3 hrs to fix
    functions/src/cleanupProject/cleanupProject.spec.ts on lines 131..147

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

    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

    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]

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

              it('exits with null if not public', async () => {
                const res = await indexActionTemplates({
                  after: { exists: true, data: () => ({ displayName: 'asdf' }) },
                  before: { exists: true, data: () => ({ displayName: 'asdf' }) }
                })
            functions/src/indexUser/indexUser.spec.ts on lines 68..74

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

            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

              it('exits with null if display name did not change', async () => {
                const res = await indexUser({
                  after: { exists: true, data: () => ({ displayName: 'asdf' }) },
                  before: { exists: true, data: () => ({ displayName: 'asdf' }) }
                })
            Severity: Major
            Found in functions/src/indexUser/indexUser.spec.ts and 1 other location - About 3 hrs to fix
            functions/src/indexActionTemplates/indexActionTemplates.spec.ts on lines 58..64

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

            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 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)

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

                          <Grid item xs={12} sm={6} md={4} className={classes.section}>
                            <Typography variant="h6" className={classes.sectionHeader}>
                              Build apps fast, without breaking things
                            </Typography>
                            <Typography variant="subtitle1">
              Severity: Major
              Found in src/routes/Home/components/HomePage/HomePage.js and 1 other location - About 2 hrs to fix
              src/routes/Home/components/HomePage/HomePage.js on lines 53..63

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

              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

                          <Grid item xs={12} sm={6} md={4} className={classes.section}>
                            <Typography variant="h6" className={classes.sectionHeader}>
                              One console, where you can see what has been done
                            </Typography>
                            <Typography variant="subtitle1">
              Severity: Major
              Found in src/routes/Home/components/HomePage/HomePage.js and 1 other location - About 2 hrs to fix
              src/routes/Home/components/HomePage/HomePage.js on lines 33..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 94.

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

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

                                  {map(actionTemplates, (template, templateIdx) => {
                                    return (
                                      <Grid
                                        item
                                        xs={12}
                    src/routes/ActionTemplates/components/PrivateActionTemplates/PrivateActionTemplates.js on lines 38..52

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

                    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

                                {currentUserTemplates.map((template, templateIdx) => {
                                  return (
                                    <Grid
                                      item
                                      xs={12}
                    src/routes/ActionTemplates/components/ActionTemplatesList/ActionTemplatesList.js on lines 142..156

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

                    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