Reconmap/web-client

View on GitHub

Showing 99 of 451 total issues

Function ClientDetails has 322 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ClientDetails = () => {
    const { clientId } = useParams();
    const navigate = useNavigate();

    const [client] = useFetch(`/clients/${clientId}`);
Severity: Major
Found in src/components/clients/Details.jsx - About 1 day to fix

Function TaskDetails has 264 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TaskDetails = () => {
    const { user: loggedInUser } = useAuth();
    const navigate = useNavigate();
    const { taskId } = useParams();
    const [task, fetchTask] = useFetch(`/tasks/${taskId}`);
Severity: Major
Found in src/components/tasks/Details.jsx - About 1 day to fix

Function OrganisationForm has 244 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const OrganisationForm = () => {
    const [organisation, setOrganisation] = useState(Organisation);

    const [rootOrganisation, refetchOrganisation] = useFetch(
        "/organisations/root",
Severity: Major
Found in src/components/settings/Organisation/Form.jsx - About 1 day to fix

File Form.jsx has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    Accordion,
    AccordionButton,
    AccordionIcon,
    AccordionItem,
Severity: Major
Found in src/components/vulnerabilities/Form.jsx - About 1 day to fix

Function CommandDetails has 186 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CommandDetails = () => {
    const { commandId } = useParams();
    const navigate = useNavigate();

    const [command] = useFetch(`/commands/${commandId}`);
Severity: Major
Found in src/components/commands/Details.jsx - About 7 hrs to fix

File OwaspRR.jsx has 460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Input } from '@chakra-ui/react';
import { useState } from 'react';
import Select from "react-select";
import { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart } from 'recharts';

Severity: Minor
Found in src/components/vulnerabilities/OwaspRR.jsx - About 7 hrs to fix

Function VulnerabilityForm has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

const VulnerabilityForm = ({
    isEditForm = false,
    vulnerability,
    vulnerabilitySetter: setVulnerability,
    onFormSubmit,
Severity: Minor
Found in src/components/vulnerabilities/Form.jsx - About 6 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

Function VulnerabilityDetails has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VulnerabilityDetails = () => {
    const navigate = useNavigate();
    const { vulnerabilityId } = useParams();
    const [vulnerability, updateVulnerability] = useFetch(
        `/vulnerabilities/${vulnerabilityId}`,
Severity: Major
Found in src/components/vulnerabilities/Details.jsx - About 5 hrs to fix

Function VulnerabilitiesList has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VulnerabilitiesList = () => {
    const navigate = useNavigate();
    const query = useQuery();
    let pageNumber = query.get("page");
    pageNumber = pageNumber !== null ? parseInt(pageNumber) : 1;
Severity: Major
Found in src/components/vulnerabilities/List.jsx - About 5 hrs to fix

Function VulnerabilityTemplatesList has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VulnerabilityTemplatesList = () => {
    const navigate = useNavigate();
    const [sortBy, setSortBy] = useState({
        column: "insert_ts",
        order: "DESC",
Severity: Major
Found in src/components/vulnerabilities/templates/List.jsx - About 5 hrs to fix

File Details.jsx has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    Button,
    ButtonGroup,
    Tab,
    TabList,
Severity: Minor
Found in src/components/clients/Details.jsx - About 5 hrs to fix

Function UsersList has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UsersList = () => {
    const navigate = useNavigate();
    const { user: loggedInUser } = useContext(AuthContext);
    const [users, updateUsers] = useFetch("/users");
    const deleteUser = useDelete("/users/", updateUsers);
Severity: Major
Found in src/components/users/List.jsx - About 4 hrs to fix

Function SendReport has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SendReport = () => {
    const navigate = useNavigate();
    const { projectId } = useParams();
    const [project] = useFetch(`/projects/${projectId}`);
    const [revisions] = useFetch(`/reports?projectId=${projectId}`);
Severity: Major
Found in src/components/reports/Send.jsx - About 4 hrs to fix

Function UserPreferences has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UserPreferences = () => {
    const { i18n } = useTranslation();

    const { user } = useAuth();

Severity: Major
Found in src/components/users/Preferences.jsx - About 4 hrs to fix

Function VaultItemEdit has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VaultItemEdit = () => {
    const { projectId, vaultItemId } = useParams();
    const navigate = useNavigate();

    const [item, setVaultItem] = useState({ ...Vault });
Severity: Major
Found in src/components/projects/vault/VaultItemEdit.jsx - About 4 hrs to fix

Function OwaspRR has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

const OwaspRR = ({
    vulnerability,
    vulnerabilitySetter: setVulnerability
}) => {

Severity: Minor
Found in src/components/vulnerabilities/OwaspRR.jsx - About 4 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

Function TemplatesList has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TemplatesList = () => {
    const navigate = useNavigate();
    const [templates, updateTemplates] = useFetch("/projects?isTemplate=1");

    const cloneProject = (ev, templateId) => {
Severity: Major
Found in src/components/projects/templates/List.jsx - About 3 hrs to fix

Function ReportTemplatesList has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReportTemplatesList = () => {
    const [templates, refetchTemplates] = useFetch('/reports/templates')

    const destroy = useDelete('/reports/', refetchTemplates);

Severity: Major
Found in src/components/reports/templates/List.jsx - About 3 hrs to fix

Function TasksList has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TasksList = () => {
    const navigate = useNavigate();

    const [tableModel, setTableModel] = useState(new TaskTableModel(true, true))

Severity: Major
Found in src/components/tasks/List.jsx - About 3 hrs to fix

Function ProjectMembership has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ProjectMembership = () => {
    const { projectId } = useParams();
    const [users] = useFetch(`/users`)
    const [members, updateMembers] = useFetch(`/projects/${projectId}/users`)
    const [savedProject] = useFetch(`/projects/${projectId}`);
Severity: Major
Found in src/components/projects/Membership.jsx - About 3 hrs to fix
Severity
Category
Status
Source
Language