Reconmap/web-client

View on GitHub

Showing 102 of 450 total issues

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

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

import {
    Button,
    HStack,
    Tab,
    TabList,
Severity: Minor
Found in src/components/tasks/Details.jsx - About 3 hrs to fix

Function TemplateDetails has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TemplateDetails = () => {
    const navigate = useNavigate();
    const { templateId } = useParams();
    const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)

Severity: Major
Found in src/components/vulnerabilities/categories/Details.jsx - About 3 hrs to fix

Function AdvancedSearch has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    const [keywords, setKeywords] = useState("");
    const [entities, setEntities] = useState(Object.keys(entityList));
Severity: Major
Found in src/components/search/AdvancedSearch.jsx - About 3 hrs to fix

Function ProjectsList has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function ClientsList has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ClientsList = () => {
    const navigate = useNavigate();
    const [clients, updateTasks] = useFetch("/clients");

    const destroy = useDelete("/clients/", updateTasks);
Severity: Major
Found in src/components/clients/List.jsx - About 2 hrs to fix

Function CommandUsageForm has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const CommandUsageForm = ({
    isEditForm = false,
    onFormSubmit,
    command,
    commandSetter: setCommand,
Severity: Minor
Found in src/components/commands/UsageForm.jsx - 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

Function TargetView has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TargetView = () => {
    const navigate = useNavigate();
    const { targetId } = useParams();
    const [target] = useFetch(`/targets/${targetId}`)
    const destroy = useDelete(`/targets/`);
Severity: Major
Found in src/components/target/View.jsx - About 2 hrs to fix

Function SearchResults has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SearchResults = React.memo(() => {
    const params = useParams();
    const query = useQuery();
    const keywords = decodeURIComponent(params.keywords);

Severity: Major
Found in src/components/search/Results.jsx - About 2 hrs to fix

Function CustomFieldsPage has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CustomFieldsPage = () => {
    const [customFields, refetchCustomFields] = useFetch(
        "/system/custom-fields",
    );

Severity: Major
Found in src/components/settings/CustomFields/Form.jsx - About 2 hrs to fix

Function VulnerabilityCategoriesPage has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VulnerabilityCategoriesPage = () => {
    const [categories, fetchParentCategories] = useFetch('/vulnerabilities/categories?parentsOnly=0')

    const destroy = useDelete('/vulnerabilities/categories/', fetchParentCategories);

Severity: Major
Found in src/components/vulnerabilities/categories/List.jsx - About 2 hrs to fix

Function ImportForm has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ImportForm = () => {

    const [importResponse, setImportResponse] = useState(null);
    const [importButtonDisabled, setImportButtonDisabled] = useState(true);

Severity: Major
Found in src/components/system/ImportForm.jsx - About 2 hrs to fix

Function CommandsListPage has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

File Instructions.jsx has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    Button,
    FormControl,
    FormErrorMessage,
    FormHelperText,
Severity: Minor
Found in src/components/commands/Instructions.jsx - About 2 hrs to fix

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

import { Breadcrumb, Button } from "@chakra-ui/react";
import AttachmentsImageDropzone from "components/attachments/ImageDropzone";
import NativeInput from "components/form/NativeInput";
import RestrictedComponent from "components/logic/RestrictedComponent";
import PrimaryButton from "components/ui/buttons/Primary";
Severity: Minor
Found in src/components/settings/Organisation/Form.jsx - About 2 hrs to fix

Function DashboardPanels has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DashboardPanels = () => {
    const { user } = useAuth();
    user.preferences = initialiseUserPreferences(user);
    const [dashboardConfig, setDashboardConfig] = useState(user?.preferences?.['web-client.widgets'] || InitialiseWidgetConfig());
    const [visibleWidgets, setVisibleWidgets] = useState(filterWidgets(user));
Severity: Major
Found in src/components/layout/dashboard/DashboardPanels.jsx - About 2 hrs to fix

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

const VulnerabilityTemplateDetails = () => {
    const navigate = useNavigate();
    const { templateId } = useParams();
    const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)

Severity: Major
Found in src/components/vulnerabilities/templates/Details.jsx - About 2 hrs to fix

Function ReportTemplateDetails has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReportTemplateDetails = () => {
    const navigate = useNavigate();
    const { templateId } = useParams();
    const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)

Severity: Major
Found in src/components/reports/templates/Details.jsx - About 2 hrs to fix
Severity
Category
Status
Source
Language