prescottprue/fireadmin

View on GitHub

Showing 224 of 224 total issues

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

      File actions.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as admin from 'firebase-admin'
      import { get, chunk, isObject } from 'lodash'
      import { batchCopyBetweenFirestoreRefs } from './utils'
      import { downloadFromStorage, uploadToStorage } from '../utils/cloudStorage'
      import { to, promiseWaterfall } from '../utils/async'
      Severity: Minor
      Found in functions/src/actionRunner/actions.ts - About 2 hrs to fix

        Function sendBucketConfigRequest has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async function sendBucketConfigRequest(bucketConfig) {
            try {
              // Push request to callGoogleApi cloud function
              const pushRef = await database.ref('requests/callGoogleApi').push({
                api: 'storage',

          Function addEnvironment has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async function addEnvironment(newProjectData) {
              const { databaseName, serviceAccount, ...otherData } = newProjectData
          
              // Show error if service account is not selected (not part of form)
              if (!serviceAccount) {

            Function useActionRunner has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function useActionRunner({
              projectId,
              selectActionTemplate,
              selectedTemplate,
              setValue

            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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function LoginPage() {
              const classes = useStyles()
              const auth = useAuth()
              const firestore = useFirestore()
              const { showError } = useNotifications()
            Severity: Minor
            Found in src/routes/Login/components/LoginPage/LoginPage.js - 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

            Function ProjectsPage has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function ProjectsPage() {
              const classes = useStyles()
              const match = useRouteMatch()
              const { showError, showSuccess } = useNotifications()
              const [newDialogOpen, changeNewDialogOpen] = useState(false)
            Severity: Major
            Found in src/routes/Projects/components/ProjectsPage/ProjectsPage.js - About 2 hrs to fix

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

                    cy.waitUntil(() =>
                      cy.callFirestore('get', 'projects/test-project').then((project) => {
                        return (
                          project &&
                          project.roles &&
              Severity: Major
              Found in cypress/integration/Project/Permissions.spec.js and 1 other location - About 2 hrs to fix
              cypress/integration/Project/Permissions.spec.js on lines 58..67

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

              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

                    cy.waitUntil(() =>
                      cy.callFirestore('get', 'projects/test-project').then((project) => {
                        return (
                          project &&
                          project.permissions &&
              Severity: Major
              Found in cypress/integration/Project/Permissions.spec.js and 1 other location - About 2 hrs to fix
              cypress/integration/Project/Permissions.spec.js on lines 160..169

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

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

              export async function runStepsFromEvent(
                snap: admin.database.DataSnapshot,
                context: functions.EventContext
              ) {
                const eventData = snap.val()
              Severity: Major
              Found in functions/src/actionRunner/runSteps.ts - About 2 hrs to fix

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

                            <Grid item xs={12} sm={6} md={6}>
                              <Typography variant="h6">Operations Logs</Typography>
                              <Typography variant="subtitle1">
                                Event tracking for all Project based actions.
                              </Typography>
                Severity: Major
                Found in src/routes/Home/components/HomePage/HomePage.js and 2 other locations - About 1 hr to fix
                src/routes/Home/components/HomePage/HomePage.js on lines 71..76
                src/routes/Home/components/HomePage/HomePage.js on lines 91..96

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

                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

                            <Grid item xs={12} sm={6} md={6}>
                              <Typography variant="h6">Multiple Environment Support</Typography>
                              <Typography variant="subtitle1">
                                Manage multiple Firebase Instances as one Project.
                              </Typography>
                Severity: Major
                Found in src/routes/Home/components/HomePage/HomePage.js and 2 other locations - About 1 hr to fix
                src/routes/Home/components/HomePage/HomePage.js on lines 91..96
                src/routes/Home/components/HomePage/HomePage.js on lines 97..102

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

                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

                            <Grid item xs={12} sm={6} md={6}>
                              <Typography variant="h6">Project Sharing</Typography>
                              <Typography variant="subtitle1">
                                Share Projects with everyone in your team. See who does what.
                              </Typography>
                Severity: Major
                Found in src/routes/Home/components/HomePage/HomePage.js and 2 other locations - About 1 hr to fix
                src/routes/Home/components/HomePage/HomePage.js on lines 71..76
                src/routes/Home/components/HomePage/HomePage.js on lines 97..102

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

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

                export default function Notifications() {
                  const classes = useStyles()
                  const { allIds, byId, dismissNotification } = useNotifications()
                  // Only render if notifications exist
                  if (!allIds || !Object.keys(allIds).length) {
                Severity: Minor
                Found in src/modules/notification/Notifications.js - About 1 hr to fix

                  Function Layout has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function Layout(props) {
                    const { classes, children, pages, location } = props
                    const groupedPages = groupBySlugLength(pages)
                    const topLevel = topLevelChapters(pages)
                    return (
                  Severity: Minor
                  Found in docs/src/components/layout.js - About 1 hr to fix

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

                                            <MenuItem
                                              onClick={editAndClose}
                                              data-test="edit-environment-button">
                                              <ListItemIcon className={classes.icon}>
                                                <EditIcon />
                    src/routes/Projects/routes/Project/routes/Environments/components/Instance/Instance.js on lines 91..98

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

                    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

                                            <MenuItem
                                              onClick={removeAndClose}
                                              data-test="delete-environment-button">
                                              <ListItemIcon className={classes.icon}>
                                                <DeleteIcon />
                    src/routes/Projects/routes/Project/routes/Environments/components/Instance/Instance.js on lines 83..90

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

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

                    export async function runBackupsFromEvent(snap: admin.database.DataSnapshot, context: functions.EventContext) {
                      const eventData = snap.val()
                      const {
                        inputValues,
                        template: { backups, inputs }
                    Severity: Minor
                    Found in functions/src/actionRunner/runSteps.ts - About 1 hr to fix

                      Function googleLogin has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async function googleLogin() {
                          const provider = new firebase.auth.GoogleAuthProvider()
                          changeLoadingState(true)
                          const authMethod =
                            window.isMobile && window.isMobile.any
                      Severity: Minor
                      Found in src/routes/Login/components/LoginPage/LoginPage.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language