prescottprue/fireadmin

View on GitHub

Showing 224 of 224 total issues

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

function topLevelChapters(pages) {
  return filter(pages, (page) => {
    const slug = get(page, 'node.frontmatter.slug') || ''
    return slug.split('/').length === 1
  })
Severity: Major
Found in docs/src/components/layout.js and 2 other locations - About 1 hr to fix
docs/src/components/SidebarItem/SidebarItem.js on lines 31..36
docs/src/utils/index.js on lines 9..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 58.

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={onDelete} data-test="project-tile-delete">
            <ListItemIcon>
              <DeleteIcon />
            </ListItemIcon>
            <ListItemText primary="Delete" />
Severity: Major
Found in src/routes/Projects/components/ProjectTile/ProjectTile.js and 1 other location - About 1 hr to fix
src/routes/Projects/components/ProjectTile/ProjectTile.js on lines 55..60

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

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={handleEditClick} data-test="project-tile-edit">
            <ListItemIcon>
              <EditIcon />
            </ListItemIcon>
            <ListItemText primary="Edit" />
Severity: Major
Found in src/routes/Projects/components/ProjectTile/ProjectTile.js and 1 other location - About 1 hr to fix
src/routes/Projects/components/ProjectTile/ProjectTile.js on lines 61..66

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

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

  async function addRole(newRole) {
    const currentRoles = project?.roles || {}
    if (Object.values(currentRoles).some((r) => r.name === newRole.name)) {
      const existsErrMsg = `Role with name "${newRole.name}" already exists`
      showError(existsErrMsg)

    Function createRoutes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function createRoutes(store) {
      return (
        <CoreLayout>
          <SuspenseWithPerf fallback={<LoadingSpinner />} traceId="router-wait">
            <Switch>
    Severity: Minor
    Found in src/routes/index.js - About 1 hr to fix

      Function copyPathBetweenRTDBInstances has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function copyPathBetweenRTDBInstances(
        app1: admin.app.App,
        app2: admin.app.App,
        srcPath: string,
        destPath: string
      Severity: Minor
      Found in functions/src/actionRunner/actions.ts - About 1 hr to fix

        Function sendFcmMessageToUser has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function sendFcmMessageToUser(userId: string, message: string): Promise<any> {
            // Get user profile
          const [getProfileErr, userProfileSnap] = await to(
            admin.firestore().doc(`users/${userId}`).get()
          )
        Severity: Minor
        Found in functions/src/actionRunner/runAction.ts - About 1 hr to fix

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

              try {
                await templatesRef.doc(templateToDelete.id).delete()
                changeDeleteDialogState(false)
                showSuccess('Action template successfully deleted')
              } catch (err) {
          src/routes/ActionTemplates/components/ActionTemplatesList/ActionTemplatesList.js on lines 56..76

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

          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

              try {
                const newTemplateWithMeta = {
                  public: false,
                  ...newTemplate,
                  createdBy: user.uid,
          src/routes/ActionTemplates/components/ActionTemplatesList/ActionTemplatesList.js on lines 84..93

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

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

          function EditEnvironmentDialog({
            onSubmit,
            projectId,
            onRequestClose,
            open,

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

          function SharingDialog({ open, onRequestClose, project }) {
            const classes = useStyles()
            const { showSuccess, showError } = useNotifications()
            const [selectedCollaborators, changeSelectedCollaborators] = useState([])
          
          
          Severity: Minor
          Found in src/routes/Projects/components/SharingDialog/SharingDialog.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 callGoogleApi has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export default async function callGoogleApi(
            snap: admin.database.DataSnapshot,
            context: functions.EventContext
          ): Promise<any> {
            const eventVal = snap.val()
          Severity: Minor
          Found in functions/src/callGoogleApi/callGoogleApi.ts - 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 useActionTemplatesList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function useActionTemplatesList() {
            const { showSuccess, showError } = useNotifications()
          
            // State
            const [newDialogOpen, changeDialogState] = 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 SEO has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function SEO(props) {
            const { isBlogPost, path = '', lang = 'en' } = props
            const title = props.title
              ? `${props.title} | ${siteConfig.siteTitle}`
              : siteConfig.siteTitle
          Severity: Minor
          Found in docs/src/components/SEO/SEO.js - About 1 hr to fix

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

                transition: theme.transitions.create(['width', 'margin'], {
                  easing: theme.transitions.easing.sharp,
                  duration: theme.transitions.duration.enteringScreen
                })
            Severity: Major
            Found in src/layouts/SidebarLayout/SidebarLayout.styles.js and 1 other location - About 1 hr to fix
            src/layouts/SidebarLayout/SidebarLayout.styles.js on lines 13..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 56.

            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

                transition: theme.transitions.create(['width', 'margin'], {
                  easing: theme.transitions.easing.sharp,
                  duration: theme.transitions.duration.leavingScreen
                })
            Severity: Major
            Found in src/layouts/SidebarLayout/SidebarLayout.styles.js and 1 other location - About 1 hr to fix
            src/layouts/SidebarLayout/SidebarLayout.styles.js on lines 21..24

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

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

            export default function VersionChangeReloader() {
              const database = useDatabase()
              const versionInfo = useDatabaseObjectData(database.ref('versionInfo'))
            
              const sessionStorageKey = 'fireadminVersion'
            Severity: Minor
            Found in src/components/VersionChangeReloader/index.js - About 1 hr to fix

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

              function HTML(props) {
                return (
                  <html {...props.htmlAttributes}>
                    <head>
                      <meta charSet="utf-8" />
              Severity: Minor
              Found in docs/src/html.js - About 1 hr to fix

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

                    <div className={classes.root}>
                      <Typography className={classes.header}>Action Templates</Typography>
                      <ActionTemplatesList />
                    </div>
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 152..155
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 156..159
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 160..163
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 164..167

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

                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 5 locations. Consider refactoring.
                Open

                        <div className={classes.actions}>
                          <Typography className={classes.header}>Environments</Typography>
                          <ActionTemplateEnvs />
                        </div>
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 156..159
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 160..163
                src/routes/ActionTemplate/components/ActionTemplateForm/ActionTemplateForm.js on lines 164..167
                src/routes/ActionTemplates/components/ActionTemplatesPage/ActionTemplatesPage.js on lines 12..15

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

                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