Geovation/photos

View on GitHub

Showing 138 of 138 total issues

Function firebaseInit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function firebaseInit(callBackFunctionFCMTokenChange) {
  // Initialize Firebase
  if (!firebaseApp) {
    console.debug(config.FIREBASE.config);
    firebaseApp = !firebase.apps.length
Severity: Minor
Found in src/features/firebase/firebaseInit.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 uploadPhoto has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

async function uploadPhoto(image, tmpFilePath, id, location, i, num, fontWhite, fontBlack, maxWidth, maxHeight) {
Severity: Major
Found in scripts/populateDemoData.js - About 1 hr to fix

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

    function registerValidSW(swUrl, config) {
      navigator.serviceWorker
        .register(swUrl)
        .then((registration) => {
          registration.onupdatefound = () => {
    Severity: Minor
    Found in src/serviceWorkerRegistration.js - About 1 hr to fix

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

        render() {
          const { classes, handleClose } = this.props;
          const label = config.PAGES.leaderboard.label;
          return (
            <PageWrapper label={label} handleClose={handleClose} hasLogo={false}>
      Severity: Minor
      Found in src/components/Leaderboard/index.js - About 1 hr to fix

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

          rtn.promise = new Promise(async (res, rej) => {
            resolve = res;
            reject = rej;
            onProgress(0);
            try {
        Severity: Minor
        Found in src/features/firebase/dbFirebase.js - About 1 hr to fix

          Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const { classes, reloadPhotos } = this.props;
              const label = config.PAGES.about.label;
              return (
                <PageWrapper
          Severity: Minor
          Found in src/components/AboutPage.js - About 1 hr to fix

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

              chipFocused: {
                backgroundColor: emphasize(
                  theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[700],
                  0.08,
                ),
            Severity: Major
            Found in src/components/PhotoPage/SelectControlMultipleValue.js and 1 other location - About 1 hr to fix
            src/components/PhotoPage/SelectControlSingleValue.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 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

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

              chipFocused: {
                backgroundColor: emphasize(
                  theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[700],
                  0.08,
                ),
            Severity: Major
            Found in src/components/PhotoPage/SelectControlSingleValue.js and 1 other location - About 1 hr to fix
            src/components/PhotoPage/SelectControlMultipleValue.js on lines 40..45

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

            async function addMetaDataSync(id, locationName) {
              const published = Math.random() <= publishedProbability ? true : null;
            
              let location;
              if (LOCATIONS[locationName].center) {
            Severity: Minor
            Found in scripts/populateDemoData.js - About 1 hr to fix

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

                          <Route
                            path={config.PAGES.feedbackReports.path}
                            render={(props) => (
                              <FeedbackReportsSubrouter
                                {...props}
              Severity: Major
              Found in src/App.js and 1 other location - About 1 hr to fix
              src/App.js on lines 776..781

              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

              function SingleValue(props) {
                return (
                  <Typography className={props.selectProps.classes.singleValue} {...props.innerProps}>
                    {props.children}
                  </Typography>
              Severity: Major
              Found in src/components/PhotoPage/SelectControlMultipleValue.js and 1 other location - About 1 hr to fix
              src/components/PhotoPage/SelectControlSingleValue.js on lines 140..146

              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

                        <Route
                          path={config.PAGES.writeFeedback.path}
                          render={(props) => (
                            <WriteFeedbackPage {...props} handleClose={history.goBack} />
                          )}
              Severity: Major
              Found in src/App.js and 1 other location - About 1 hr to fix
              src/App.js on lines 738..746

              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

              function SingleValue(props) {
                return (
                  <Typography className={props.selectProps.classes.singleValue} {...props.innerProps}>
                    {props.children}
                  </Typography>
              Severity: Major
              Found in src/components/PhotoPage/SelectControlSingleValue.js and 1 other location - About 1 hr to fix
              src/components/PhotoPage/SelectControlMultipleValue.js on lines 137..143

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

              function uploadPhoto(data, imgSrc, onProgress) {
                const rtn = {};
                let canceled = false;
                let uploadTask;
                let resolve;
              Severity: Minor
              Found in src/features/firebase/dbFirebase.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 render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const props = { ...this.props };
                  return (
                    <div>
                      <div
              Severity: Minor
              Found in src/components/PhotoPage/MultipleSelectControlNumbered.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if (config.USER.ENABLE_GRAVATAR_PROFILES && currentUser) {
                      gtagSetId(user.uid);
                      gtagEvent("Logged in", "User", user.uid);
                
                      // when the user logs in, need to save his fcm token so that the cloud function can message him is required.
                Severity: Major
                Found in src/features/firebase/authFirebase.js - About 1 hr to fix

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

                                  <IconButton
                                    aria-label="Approve"
                                    edge={false}
                                    onClick={() => this.props.handleApproveClick(photo)}
                                  >
                  Severity: Minor
                  Found in src/components/ModeratorPage.js and 1 other location - About 55 mins to fix
                  src/components/ModeratorPage.js on lines 74..80

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

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

                    fieldsValues = this.props.fields.reduce((a, v) => {
                      a[v.name] = { value: "", error: !"".match(v.regexValidation) };
                      return a;
                    }, {});
                  Severity: Minor
                  Found in src/components/PhotoPage/Fields.js and 1 other location - About 55 mins to fix
                  src/components/PhotoPage/MultiFields.js on lines 16..19

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

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

                      ? Object.values(this.props.field.subfields).reduce((a, v) => {
                          a[v.name] = { value: "", error: !"".match(v.regexValidation) };
                          return a;
                        }, {})
                  Severity: Minor
                  Found in src/components/PhotoPage/MultiFields.js and 1 other location - About 55 mins to fix
                  src/components/PhotoPage/Fields.js on lines 16..19

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

                  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

                                  <IconButton
                                    aria-label="Reject"
                                    edge={false}
                                    onClick={() => this.props.handleRejectClick(photo)}
                                  >
                  Severity: Minor
                  Found in src/components/ModeratorPage.js and 1 other location - About 55 mins to fix
                  src/components/ModeratorPage.js on lines 81..87

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

                  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