Showing 31 of 86 total issues
Function Signup
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Signup = () => {
const {
createAccount,
enterDetails,
name,
File [project].js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
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';
File index.jsx
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
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,
Function Login
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Login = () => {
const { locale } = useRouter();
const { welcome, loginFull, email, password, loginError, verifyError, login, forgot } =
useLocale();
Function prepareMiddleware
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareMiddleware({ keystone }) {
const middleware = express();
middleware.get('/download', (req, res) =>
runCustomQuery({
keystone,
Function Toolbar
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Toolbar() {
const [{ editing, modeId }, dispatch] = useDraw();
return (
<div
Function prepareMiddleware
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareMiddleware({ keystone }) {
const middleware = express();
middleware.get('/duplicate/:id', (req, res) =>
runCustomQuery({
keystone,
Function Reset
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Reset = () => {
const { reset, resetInstructions, email: emailText, resetPassword, resetSuccess } = useLocale();
const [email, setEmail] = useState('');
const [error, setError] = useState('');
const [loading, setLoading] = useState(false);
Function populateBasemaps
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const populateBasemaps = async (keystone, context) => {
// Populate basemaps
const {
data: { allBasemaps },
} = await keystone.executeGraphQL({
Function populateLayers
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const populateLayers = async (keystone, context) => {
// Populate layers
const {
data: { allLayers },
} = await keystone.executeGraphQL({
Function setMapYear
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const setMapYear = () => {
const map = mapRef.current.getMap();
let style = null;
try {
style = map.getStyle();
Function onUpdate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onUpdate(e) {
const { data, editType } = e;
dispatch(['SET_FEATURES', data]);
Function prepareMiddleware
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareMiddleware({ keystone }) {
const middleware = express();
middleware.post('/reset', (req, res) => {
const { email } = req.body;
return runCustomQuery({
Function addInitialUser
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const addInitialUser = async (keystone, context) => {
// Count existing users
const {
data: {
_allUsersMeta: { count },
Function Slide
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
const Slide = ({
id,
title,
index,
color,
- Read upRead up
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
Open
prepareMiddleware({ keystone }) {
const middleware = express();
middleware.post('/password', (req, res) => {
const { key, password } = req.body;
return runCustomQuery({
Function documentReqs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const documentReqs = documents.map(m => {
const variables = {
...m,
firstYear: m.firstyear,
lastYear: m.lastyear,
Function EditPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
const EditPage = ({ project, statusCode }) => {
if (statusCode) return <ErrorPage statusCode={statusCode} />;
const [activeSlide, setActiveSlide] = useState(null);
const [apiLoading, setApiLoading] = useState(false);
- Read upRead up
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
Open
const getMapProps = () => {
let props = {
ref: mapRef,
mapboxApiAccessToken: 'pk.eyJ1IjoiYXhpc21hcHMiLCJhIjoieUlmVFRmRSJ9.CpIxovz1TUWe_ecNLFuHNg',
mapStyle: '/style/style.json',
Function layers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 {