civictechindex/CTI-website-frontend

View on GitHub

Showing 39 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

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

      <ProjectCard
        homepage={project.homepage}
        issueCount={project.open_issues}
        lastUpdate={calculateDaysSince(project.updated_at)}
        organizationAvatarUrl={project.owner.avatar_url}
Severity: Major
Found in src/pages/SearchProjects/index.js and 1 other location - About 6 hrs to fix
src/pages/IndvOrganization/RenderProjectCard.js on lines 23..38

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

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

      <ProjectCard
        homepage={project.homepage}
        issueCount={project.open_issues}
        lastUpdate={calculateDaysSince(project.updated_at)}
        organizationAvatarUrl={project.owner.avatar_url}
Severity: Major
Found in src/pages/IndvOrganization/RenderProjectCard.js and 1 other location - About 6 hrs to fix
src/pages/SearchProjects/index.js on lines 54..69

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

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

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

                <Affiliated
                  affiliatedCount={affiliatedCount}
                  classes={classes}
                  expandedOrgs={expandedOrgs}
                  setExpandedOrgs={(expanded) => {
Severity: Major
Found in src/pages/Contributors/index.js and 1 other location - About 3 hrs to fix
src/pages/Contributors/index.js on lines 371..386

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

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

                <Affiliated
                  affiliatedCount={affiliatedCount}
                  classes={classes}
                  expandedOrgs={expandedOrgs}
                  setExpandedOrgs={(expanded) => {
Severity: Major
Found in src/pages/Contributors/index.js and 1 other location - About 3 hrs to fix
src/pages/Contributors/index.js on lines 397..412

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

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 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
Severity
Category
Status
Source
Language