Showing 102 of 450 total issues
Function TemplatesList
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TemplatesList = () => {
const navigate = useNavigate();
const [templates, updateTemplates] = useFetch("/projects?isTemplate=1");
const cloneProject = (ev, templateId) => {
- Create a ticketCreate a ticket
Function ReportTemplatesList
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReportTemplatesList = () => {
const [templates, refetchTemplates] = useFetch('/reports/templates')
const destroy = useDelete('/reports/', refetchTemplates);
- Create a ticketCreate a ticket
Function ProjectMembership
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ProjectMembership = () => {
const { projectId } = useParams();
const [users] = useFetch(`/users`)
const [members, updateMembers] = useFetch(`/projects/${projectId}/users`)
const [savedProject] = useFetch(`/projects/${projectId}`);
- Create a ticketCreate a ticket
File Details.jsx
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
Button,
HStack,
Tab,
TabList,
- Create a ticketCreate a ticket
Function TemplateDetails
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TemplateDetails = () => {
const navigate = useNavigate();
const { templateId } = useParams();
const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)
- Create a ticketCreate a ticket
Function AdvancedSearch
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AdvancedSearch = () => {
const navigate = useNavigate();
const [keywords, setKeywords] = useState("");
const [entities, setEntities] = useState(Object.keys(entityList));
- Create a ticketCreate a ticket
Function ProjectsList
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ProjectsList = () => {
const navigate = useNavigate();
const query = useQuery();
let pageNumber = query.get('page');
pageNumber = pageNumber !== null ? parseInt(pageNumber) : 1;
- Create a ticketCreate a ticket
Function ClientsList
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ClientsList = () => {
const navigate = useNavigate();
const [clients, updateTasks] = useFetch("/clients");
const destroy = useDelete("/clients/", updateTasks);
- Create a ticketCreate a ticket
Function CommandUsageForm
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
const CommandUsageForm = ({
isEditForm = false,
onFormSubmit,
command,
commandSetter: setCommand,
- Read upRead up
- Create a ticketCreate a ticket
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
Open
const TargetView = () => {
const navigate = useNavigate();
const { targetId } = useParams();
const [target] = useFetch(`/targets/${targetId}`)
const destroy = useDelete(`/targets/`);
- Create a ticketCreate a ticket
Function SearchResults
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SearchResults = React.memo(() => {
const params = useParams();
const query = useQuery();
const keywords = decodeURIComponent(params.keywords);
- Create a ticketCreate a ticket
Function CustomFieldsPage
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CustomFieldsPage = () => {
const [customFields, refetchCustomFields] = useFetch(
"/system/custom-fields",
);
- Create a ticketCreate a ticket
Function VulnerabilityCategoriesPage
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const VulnerabilityCategoriesPage = () => {
const [categories, fetchParentCategories] = useFetch('/vulnerabilities/categories?parentsOnly=0')
const destroy = useDelete('/vulnerabilities/categories/', fetchParentCategories);
- Create a ticketCreate a ticket
Function ImportForm
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ImportForm = () => {
const [importResponse, setImportResponse] = useState(null);
const [importButtonDisabled, setImportButtonDisabled] = useState(true);
- Create a ticketCreate a ticket
Function CommandsListPage
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CommandsListPage = () => {
const navigate = useNavigate();
const query = useQuery();
let pageNumber = query.get('page');
pageNumber = pageNumber !== null ? parseInt(pageNumber) : 1;
- Create a ticketCreate a ticket
File Instructions.jsx
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
Button,
FormControl,
FormErrorMessage,
FormHelperText,
- Create a ticketCreate a ticket
File Form.jsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
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";
- Create a ticketCreate a ticket
Function DashboardPanels
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
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));
- Create a ticketCreate a ticket
Function VulnerabilityTemplateDetails
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const VulnerabilityTemplateDetails = () => {
const navigate = useNavigate();
const { templateId } = useParams();
const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)
- Create a ticketCreate a ticket
Function ReportTemplateDetails
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReportTemplateDetails = () => {
const navigate = useNavigate();
const { templateId } = useParams();
const [vulnerability] = useFetch(`/vulnerabilities/${templateId}`)
- Create a ticketCreate a ticket