civictechindex/CTI-website-frontend

View on GitHub

Showing 25 of 39 total issues

Function TagGeneratorWizard has 429 lines of code (exceeds 150 allowed). Consider refactoring.
Open

const TagGeneratorWizard = () => {
  const theme = useTheme();
  const classes = useStyles();
  const [changeValue, setChangeValue] = useQueryParam(
    'changeValue',
Severity: Major
Found in src/pages/TagGeneratorWizard/index.js - About 1 day to fix

Function Contributors has 360 lines of code (exceeds 150 allowed). Consider refactoring.
Open

export default function Contributors() {
  const classes = useStyle();
  const location = useLocation();
  const [affiliatedCount, setAffiliatedCount] = useState(0);
  const [affiliatedOrganizations, setAffiliatedOrganizations] = useState([]);
Severity: Major
Found in src/pages/Contributors/index.js - About 1 day to fix

Function Privacy has 359 lines of code (exceeds 150 allowed). Consider refactoring.
Open

const Privacy = () => {
  const classes = useStyles();
  const breadCrumbLinks = [
    { href: '/home', name: 'Home' },
    { href: '/privacy', name: 'Privacy' },
Severity: Major
Found in src/pages/Privacy/index.js - About 1 day to fix

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

/* eslint-disable max-lines-per-function */
/* eslint-disable complexity */

import React, { useState, useEffect, useRef } from 'react';
import Link from '../../components/common/Link';
Severity: Major
Found in src/pages/TagGeneratorWizard/index.js - About 1 day to fix

Function SearchProjects has 308 lines of code (exceeds 150 allowed). Consider refactoring.
Open

const SearchProjects = () => {
  const classes = useStyles();
  const location = useLocation();
  const [affiliations, setAffiliations] = useState({});
  const [backupFilterList, setBackupFilterList] = useState([]);
Severity: Major
Found in src/pages/SearchProjects/index.js - About 7 hrs to fix

Function AddOrgForm has a Cognitive Complexity of 49 (exceeds 8 allowed). Consider refactoring.
Open

const AddOrgForm = React.forwardRef(({ open, onClose }, ref) => {
  const [step, setStep] = useState(0);
  const [apiErrors, setApiErrors] = useState({});
  const [city, setCity] = useState('');
  const [country, setCountry] = useState({ code: '', label: '' });
Severity: Minor
Found in src/pages/TagGeneratorWizard/AddOrgForm/index.js - About 7 hrs 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 theme-mui.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable sort-keys */
import createBreakpoints from '@material-ui/core/styles/createBreakpoints';
import deepmerge from '@material-ui/utils/deepmerge';
import spectrum from './theme-spectrum';

Severity: Minor
Found in src/theme-mui.js - About 6 hrs to fix

Function SearchProjects has a Cognitive Complexity of 42 (exceeds 8 allowed). Consider refactoring.
Open

const SearchProjects = () => {
  const classes = useStyles();
  const location = useLocation();
  const [affiliations, setAffiliations] = useState({});
  const [backupFilterList, setBackupFilterList] = useState([]);
Severity: Minor
Found in src/pages/SearchProjects/index.js - About 5 hrs 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 index.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-lines-per-function */
/* eslint-disable complexity */
/* eslint-disable react-hooks/exhaustive-deps */

import React, { useEffect, useState } from 'react';
Severity: Minor
Found in src/pages/Contributors/index.js - About 5 hrs to fix

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

import React from 'react';
import Box from '@material-ui/core/Box';
import Container from '@material-ui/core/Container';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
Severity: Minor
Found in src/pages/Privacy/index.js - About 5 hrs to fix

File TopicTagSection.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useState } from 'react';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
Severity: Minor
Found in src/pages/TagGeneratorWizard/TopicTagSection.js - About 5 hrs to fix

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

/* eslint-disable max-lines-per-function */
import React, { useEffect, useState } from 'react';
import { useLocation } from 'react-router';
import axios from 'axios';
import Box from '@material-ui/core/Box';
Severity: Minor
Found in src/pages/SearchProjects/index.js - About 5 hrs to fix

Function TagGeneratorWizard has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring.
Open

const TagGeneratorWizard = () => {
  const theme = useTheme();
  const classes = useStyles();
  const [changeValue, setChangeValue] = useQueryParam(
    'changeValue',
Severity: Minor
Found in src/pages/TagGeneratorWizard/index.js - About 5 hrs 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 FilterSelector.js has 349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable multiline-comment-style */
import React, { useState } from 'react';
import { ThemeProvider, makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
Severity: Minor
Found in src/pages/SearchProjects/FilterSelector.js - About 4 hrs to fix

Function IndvPageContainer has 201 lines of code (exceeds 150 allowed). Consider refactoring.
Open

export const IndvPageContainer = (props) => {
  const classes = useStyles();
  const projectsPerPage = 4;

  const inputSortMethodList = ['best match', 'updated', 'stars'];
Severity: Major
Found in src/pages/IndvOrganization/IndvPageContainer.js - About 3 hrs to fix

File IndvPageContainer.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-lines-per-function */
/* eslint-disable react-hooks/exhaustive-deps */

import React, { useState, useEffect } from 'react';
import Box from '@material-ui/core/Box'
Severity: Minor
Found in src/pages/IndvOrganization/IndvPageContainer.js - About 2 hrs to fix

File ContributorThumbnail.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-lines-per-function */
/* eslint-disable complexity */
import React, { useEffect, useState } from 'react';
import Box from '@material-ui/core/Box';
import CardMedia from '@material-ui/core/CardMedia';
Severity: Minor
Found in src/components/ContributorThumbnail.js - About 2 hrs to fix

Function Thumbnail has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
Open

const Thumbnail = ({
  thumbnailInfo,
  organization,
  isOpen,
  dropdownLength,
Severity: Minor
Found in src/components/ContributorThumbnail.js - About 2 hrs 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 countryList.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const countries = [
  { code: '', label: '', phone: '' },
  { code: 'AD', label: 'Andorra', phone: '376' },
  { code: 'AE', label: 'United Arab Emirates', phone: '971' },
  { code: 'AF', label: 'Afghanistan', phone: '93' },
Severity: Minor
Found in src/pages/TagGeneratorWizard/AddOrgForm/countryList.js - About 2 hrs to fix

Function SubscribeSection has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
Open

const SubscribeSection = ({ size }) => {
  const classes = useStyles();
  const [inputValue, setInputValue] = useState('');
  const [message, setMessage] = useState('');
  const ariaLabel = { 'aria-label': 'Email Text Field' };
Severity: Minor
Found in src/components/Footer/SubscribeSection.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

Severity
Category
Status
Source
Language