trezy/firebase-system-update

View on GitHub

Showing 67 of 67 total issues

Function handler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const handler = async (request, response) => {
    const errors = []

    if (!request.query['projectID']) {
        return response.status(httpStatus.BAD_REQUEST).json({
Severity: Minor
Found in src/pages/api/project/[projectID].js - About 1 hr to fix

    Function vercelFetch has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function vercelFetch(route, options) {
        const parsedOptions = { ...options }
        const defaultOptions = {
            headers: {
                Accept: 'application/json',
    Severity: Minor
    Found in src/helpers/vercel.js - About 1 hr to fix

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

          try {
              let projectsData = null
      
              if (projectSelection === 'all') {
                  projectsData = await vercel.getAllProjects({
      Severity: Major
      Found in src/pages/api/install.js and 1 other location - About 1 hr to fix
      src/pages/api/project/[projectID].js on lines 29..47

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

      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 serviceAccountJSON = JSON.parse(project.serviceAccountJSON)
              const serviceAccountReference = await serviceAccountsCollection.add(serviceAccountJSON)
      
              const serializedProject = {
      Severity: Major
      Found in src/pages/api/project/[projectID].js and 1 other location - About 1 hr to fix
      src/pages/api/install.js on lines 89..142

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

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

      const Button = forwardRef((props, ref) => {
          const {
              children,
              className,
              isDisabled,
      Severity: Minor
      Found in src/components/Form/Button.js - About 1 hr to fix

        Function apiFetch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function apiFetch(route, options) {
            const parsedOptions = { ...options }
            const defaultOptions = {
                headers: {
                    Accept: 'application/json',
        Severity: Minor
        Found in src/helpers/api.js - About 1 hr to fix

          Function GithubExplorer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function GithubExplorer(props) {
              const {
                  onSelect,
                  projectID,
                  title,
          Severity: Minor
          Found in src/components/GithubExplorer.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 FieldColor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function FieldColor(props) {
              const {
                  className,
                  id,
                  isDisabled,
          Severity: Minor
          Found in src/components/Form/FieldColor.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 ProjectConfigurationForm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function ProjectConfigurationForm(props) {
              const { projectID } = props
              const {
                  data: { projects },
              } = useAppContext()
          Severity: Minor
          Found in src/components/Installer/ProjectConfigurationForm.js - About 1 hr to fix

            Function SelectServicesFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function SelectServicesFields() {
                return (
                    <>
                        <h3 className="heading">
                            {'Select which Firebase services you would like to have automatically deployed'}
            Severity: Minor
            Found in src/components/Installer/SelectServicesFields.js - About 1 hr to fix

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

                  const changeStepCompletion = useCallback((projectID, stepID, isComplete) => {
                      dispatch({
                          payload: {
                              isComplete,
                              projectID,
              Severity: Major
              Found in src/contexts/AppContext.js and 1 other location - About 1 hr to fix
              src/contexts/AppContext.js on lines 397..406

              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

                  const updateProjectServiceConfig = useCallback((projectID, service, serviceConfig) => {
                      dispatch({
                          payload: {
                              projectID,
                              service,
              Severity: Major
              Found in src/contexts/AppContext.js and 1 other location - About 1 hr to fix
              src/contexts/AppContext.js on lines 279..288

              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

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                      if (typeof initialProps.validate === 'function') {
                          const customError = await initialProps.validate(state, values)
                          if (customError) {
                              errors.push(customError)
                          }
              Severity: Major
              Found in src/components/Form/FieldInput.js and 3 other locations - About 55 mins to fix
              src/components/Form/FieldCheckbox.js on lines 38..43
              src/components/Form/FieldColor.js on lines 56..61
              src/components/Form/FieldRadioGroup.js on lines 43..48

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

              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

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                      if (typeof initialProps.validate === 'function') {
                          const customError = await initialProps.validate(state, values)
                          if (customError) {
                              errors.push(customError)
                          }
              Severity: Major
              Found in src/components/Form/FieldColor.js and 3 other locations - About 55 mins to fix
              src/components/Form/FieldCheckbox.js on lines 38..43
              src/components/Form/FieldInput.js on lines 61..66
              src/components/Form/FieldRadioGroup.js on lines 43..48

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

              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

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                      if (typeof initialProps.validate === 'function') {
                          const customError = await initialProps.validate(state, values)
                          if (customError) {
                              errors.push(customError)
                          }
              Severity: Major
              Found in src/components/Form/FieldRadioGroup.js and 3 other locations - About 55 mins to fix
              src/components/Form/FieldCheckbox.js on lines 38..43
              src/components/Form/FieldColor.js on lines 56..61
              src/components/Form/FieldInput.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 53.

              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

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                      if (typeof initialProps.validate === 'function') {
                          const customError = await initialProps.validate(state, values)
                          if (customError) {
                              errors.push(customError)
                          }
              Severity: Major
              Found in src/components/Form/FieldCheckbox.js and 3 other locations - About 55 mins to fix
              src/components/Form/FieldColor.js on lines 56..61
              src/components/Form/FieldInput.js on lines 61..66
              src/components/Form/FieldRadioGroup.js on lines 43..48

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

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

              export const handler = async (request, response) => {
                  const errors = []
                  const responseJSON = {
                      accessToken: null,
                      projects: {},
              Severity: Minor
              Found in src/pages/api/install.js - About 45 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

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

                  const updateValidity = useCallback((fieldName, errors) => {
                      dispatch({
                          payload: {
                              errors,
                              fieldName,
              Severity: Major
              Found in src/components/Form/index.js and 2 other locations - About 45 mins to fix
              src/components/Form/index.js on lines 134..144
              src/contexts/AppContext.js on lines 294..302

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

              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

                  const finishProjectConfiguration = useCallback((projectID, serviceAccountJSON) => {
                      dispatch({
                          payload: {
                              projectID,
                              serviceAccountJSON,
              Severity: Major
              Found in src/contexts/AppContext.js and 2 other locations - About 45 mins to fix
              src/components/Form/index.js on lines 124..132
              src/components/Form/index.js on lines 134..144

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

              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

                  const updateValue = useCallback((fieldName, value) => {
                      dispatch({
                          payload: {
                              fieldName,
                              value,
              Severity: Major
              Found in src/components/Form/index.js and 2 other locations - About 45 mins to fix
              src/components/Form/index.js on lines 124..132
              src/contexts/AppContext.js on lines 294..302

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

              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