imaginerio/narratives

View on GitHub

Showing 31 of 86 total issues

Function Signup has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Signup = () => {
  const {
    createAccount,
    enterDetails,
    name,
Severity: Major
Found in src/pages/signup.js - About 5 hrs to fix

    File [project].js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable jsx-a11y/label-has-associated-control */
    import React, { useState, useEffect } from 'react';
    import PropTypes from 'prop-types';
    import { useQuery, useMutation, gql } from '@apollo/client';
    import { map } from 'lodash';
    Severity: Minor
    Found in src/pages/project/[project].js - About 3 hrs to fix

      File index.jsx has 315 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable jsx-a11y/click-events-have-key-events */
      import React, { useEffect, useRef, useState } from 'react';
      import PropTypes from 'prop-types';
      import ReactMapGL, {
        Source,
      Severity: Minor
      Found in src/components/Atlas/index.jsx - About 3 hrs to fix

        Function Login has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Login = () => {
          const { locale } = useRouter();
          const { welcome, loginFull, email, password, loginError, verifyError, login, forgot } =
            useLocale();
        
        
        Severity: Major
        Found in src/pages/login.js - About 3 hrs to fix

          Function prepareMiddleware has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            prepareMiddleware({ keystone }) {
              const middleware = express();
              middleware.get('/download', (req, res) =>
                runCustomQuery({
                  keystone,
          Severity: Major
          Found in routes/download.js - About 2 hrs to fix

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

            export default function Toolbar() {
              const [{ editing, modeId }, dispatch] = useDraw();
            
              return (
                <div
            Severity: Major
            Found in src/components/Toolbar/index.jsx - About 2 hrs to fix

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

                prepareMiddleware({ keystone }) {
                  const middleware = express();
                  middleware.get('/duplicate/:id', (req, res) =>
                    runCustomQuery({
                      keystone,
              Severity: Major
              Found in routes/duplicate.js - About 2 hrs to fix

                Function Reset has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Reset = () => {
                  const { reset, resetInstructions, email: emailText, resetPassword, resetSuccess } = useLocale();
                  const [email, setEmail] = useState('');
                  const [error, setError] = useState('');
                  const [loading, setLoading] = useState(false);
                Severity: Minor
                Found in src/pages/reset.js - About 1 hr to fix

                  Function populateBasemaps has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const populateBasemaps = async (keystone, context) => {
                    // Populate basemaps
                    const {
                      data: { allBasemaps },
                    } = await keystone.executeGraphQL({
                  Severity: Minor
                  Found in initial-data.js - About 1 hr to fix

                    Function populateLayers has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const populateLayers = async (keystone, context) => {
                      // Populate layers
                      const {
                        data: { allLayers },
                      } = await keystone.executeGraphQL({
                    Severity: Minor
                    Found in initial-data.js - About 1 hr to fix

                      Function setMapYear has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const setMapYear = () => {
                          const map = mapRef.current.getMap();
                          let style = null;
                          try {
                            style = map.getStyle();
                      Severity: Minor
                      Found in src/components/Atlas/index.jsx - About 1 hr to fix

                        Function onUpdate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function onUpdate(e) {
                            const { data, editType } = e;
                        
                            dispatch(['SET_FEATURES', data]);
                        
                        
                        Severity: Minor
                        Found in src/providers/DrawProvider/index.js - About 1 hr to fix

                          Function prepareMiddleware has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            prepareMiddleware({ keystone }) {
                              const middleware = express();
                              middleware.post('/reset', (req, res) => {
                                const { email } = req.body;
                                return runCustomQuery({
                          Severity: Minor
                          Found in routes/reset.js - About 1 hr to fix

                            Function addInitialUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const addInitialUser = async (keystone, context) => {
                              // Count existing users
                              const {
                                data: {
                                  _allUsersMeta: { count },
                            Severity: Minor
                            Found in initial-data.js - About 1 hr to fix

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

                              const Slide = ({
                                id,
                                title,
                                index,
                                color,
                              Severity: Minor
                              Found in src/components/Slide/index.jsx - 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 prepareMiddleware has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                prepareMiddleware({ keystone }) {
                                  const middleware = express();
                                  middleware.post('/password', (req, res) => {
                                    const { key, password } = req.body;
                                    return runCustomQuery({
                              Severity: Minor
                              Found in routes/password.js - About 1 hr to fix

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

                                  const documentReqs = documents.map(m => {
                                    const variables = {
                                      ...m,
                                      firstYear: m.firstyear,
                                      lastYear: m.lastyear,
                                Severity: Minor
                                Found in initial-data.js - About 1 hr to fix

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

                                  const EditPage = ({ project, statusCode }) => {
                                    if (statusCode) return <ErrorPage statusCode={statusCode} />;
                                  
                                    const [activeSlide, setActiveSlide] = useState(null);
                                    const [apiLoading, setApiLoading] = useState(false);
                                  Severity: Minor
                                  Found in src/pages/edit/[project].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 getMapProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const getMapProps = () => {
                                      let props = {
                                        ref: mapRef,
                                        mapboxApiAccessToken: 'pk.eyJ1IjoiYXhpc21hcHMiLCJhIjoieUlmVFRmRSJ9.CpIxovz1TUWe_ecNLFuHNg',
                                        mapStyle: '/style/style.json',
                                  Severity: Minor
                                  Found in src/components/Atlas/index.jsx - About 1 hr to fix

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

                                            style.layers = style.layers.map(layer => {
                                              if (layer.source === 'composite') {
                                                const filter =
                                                  layer.filter && layer.filter[1][0] === 'match' ? layer.filter.slice(0, 2) : ['all'];
                                                return {
                                    Severity: Minor
                                    Found in src/components/Atlas/index.jsx - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language