Geovation/photos

View on GitHub

Showing 138 of 138 total issues

Function App has 701 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const App = (props) => {
  const { classes, dispatch, history, location, geojson, online, user } = props;
  const fields = Object.values(config.PHOTO_FIELDS);

  const [file, setFile] = useState(null);
Severity: Major
Found in src/App.js - About 3 days to fix

    File App.js has 762 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState, useContext, useEffect, useRef, Fragment } from "react";
    import { Route, Switch, withRouter } from "react-router-dom";
    import { connect } from "react-redux";
    
    import * as localforage from "localforage";
    Severity: Major
    Found in src/App.js - About 1 day to fix

      Function App has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

      const App = (props) => {
        const { classes, dispatch, history, location, geojson, online, user } = props;
        const fields = Object.values(config.PHOTO_FIELDS);
      
        const [file, setFile] = useState(null);
      Severity: Minor
      Found in src/App.js - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      File dbFirebase.js has 466 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import firebase from "firebase/app";
      import _ from "lodash";
       
      import * as localforage from "localforage";
      
      
      Severity: Minor
      Found in src/features/firebase/dbFirebase.js - About 7 hrs to fix

        File categories.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        export const data = {
          1: {
            label: "Non-specific Plastic",
            children: {
              100: {
        Severity: Minor
        Found in src/custom/categories.js - About 7 hrs to fix

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

                139: {
                  label: "Wood",
                  children: {
                    1059: {
                      label: "Corks"
          Severity: Major
          Found in src/custom/categories.js and 1 other location - About 5 hrs to fix
          src/custom/categories.js on lines 290..321

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

          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

                135: {
                  label: "Sanitary",
                  children: {
                    1031: {
                      label: "Condoms"
          Severity: Major
          Found in src/custom/categories.js and 1 other location - About 5 hrs to fix
          src/custom/categories.js on lines 410..437

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

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

            render() {
              const {
                user,
                placeholderImage,
                feature,
          Severity: Major
          Found in src/components/MapPage/DisplayPhoto.js - About 5 hrs to fix

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

              handleClickRemove = (e) => {
                this.index = this.index > 0 ? this.index - 1 : 0;
            
                const components = [...this.state.components];
                components.pop();
            Severity: Major
            Found in src/components/PhotoPage/MultipleSelectControlTextFields.js and 1 other location - About 4 hrs to fix
            src/components/PhotoPage/MultipleSelectControlNumbered.js on lines 32..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 124.

            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

              handleClickRemove = (e) => {
                this.index = this.index > 0 ? this.index - 1 : 0;
            
                const components = [...this.state.components];
                components.pop();
            Severity: Major
            Found in src/components/PhotoPage/MultipleSelectControlNumbered.js and 1 other location - About 4 hrs to fix
            src/components/PhotoPage/MultipleSelectControlTextFields.js on lines 32..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 124.

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

              render() {
                const {
                  classes,
                  user,
                  online,
            Severity: Major
            Found in src/components/DrawerContainer.js - About 4 hrs to fix

              Function componentDidMount has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                componentDidMount(months, ctx) {
                  const { geojson } = this.props;
              
                  if (geojson) {
                    const withNumber = _.filter(geojson.features, (f) => f.properties.number);
              Severity: Major
              Found in src/custom/components/ReportsPage.js - About 4 hrs to fix

                File index.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const _ = require("lodash");
                const json2csv = require("json2csv");
                // https://firebase.google.com/docs/functions/locations
                const functions = require("firebase-functions").region("europe-west2");
                const mkdirp = require("mkdirp");
                Severity: Minor
                Found in functions/index.js - About 4 hrs to fix

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

                    getItems = (tree) => {
                      let items = [];
                  
                      function getNodesInLowestHierarchy(tree){
                        Object.entries(tree).forEach( ([key,value]) => {
                  Severity: Major
                  Found in src/components/PhotoPage/SelectControlMultipleValue.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/SelectControlSingleValue.js on lines 230..246

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

                  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

                    getItems = (tree) => {
                      let items = [];
                  
                      function getNodesInLowestHierarchy(tree){
                        Object.entries(tree).forEach( ([key,value]) => {
                  Severity: Major
                  Found in src/components/PhotoPage/SelectControlSingleValue.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/SelectControlMultipleValue.js on lines 281..297

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

                  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

                          <div
                            style={{
                              display: "flex",
                              flexDirection: "column",
                              alignItems: "flex-start",
                  Severity: Major
                  Found in src/components/PhotoPage/MultipleSelectControlTextFields.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/MultipleSelectControlNumbered.js on lines 63..79

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

                  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 MultiValue(props) {
                    return (
                      <Chip
                        tabIndex={-1}
                        label={props.children}
                  Severity: Major
                  Found in src/components/PhotoPage/SelectControlSingleValue.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/SelectControlMultipleValue.js on lines 149..161

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

                  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

                          <div
                            style={{
                              display: "flex",
                              flexDirection: "column",
                              alignItems: "flex-start",
                  Severity: Major
                  Found in src/components/PhotoPage/MultipleSelectControlNumbered.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/MultipleSelectControlTextFields.js on lines 85..101

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

                  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 MultiValue(props) {
                    return (
                      <Chip
                        tabIndex={-1}
                        label={props.children}
                  Severity: Major
                  Found in src/components/PhotoPage/SelectControlMultipleValue.js and 1 other location - About 4 hrs to fix
                  src/components/PhotoPage/SelectControlSingleValue.js on lines 152..164

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

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  File Map.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { Component } from "react";
                  import { connect } from 'react-redux';
                  
                  import _ from "lodash";
                  import mapboxgl from '!mapbox-gl'; // eslint-disable-line import/no-webpack-loader-syntax
                  Severity: Minor
                  Found in src/components/MapPage/Map.js - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language