Showing 102 of 450 total issues
Function updateSelectedValue
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const updateSelectedValue = (event, id) => {
switch (id) {
case 'SL':
setSkillLevelValue(event);
break;
- Create a ticketCreate a ticket
Function DocumentDetailsPage
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DocumentDetailsPage = () => {
const { documentId } = useParams();
const navigate = useNavigate();
const [serverDoc] = useFetch(`/documents/${documentId}`)
- Create a ticketCreate a ticket
File Links.jsx
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
faBriefcase,
faCode,
faCog,
faMagnifyingGlass,
- Create a ticketCreate a ticket
File VulnerabilitiesTable.jsx
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Stack } from "@chakra-ui/react";
import NativeCheckbox from "components/form/NativeCheckbox";
import RestrictedComponent from "components/logic/RestrictedComponent";
import ProjectBadge from "components/projects/ProjectBadge";
import AscendingSortLink from "components/ui/AscendingSortLink";
- Create a ticketCreate a ticket
Function NotificationsList
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const NotificationsList = () => {
const [notifications, fetchNotifications] = useFetch('/notifications')
const markNotificationAsRead = notification => {
secureApiFetch(`/notifications/${notification.id}`, {
- Create a ticketCreate a ticket
Function TemplateDetails
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TemplateDetails = () => {
const navigate = useNavigate();
const { templateId } = useParams();
const [template] = useFetch(`/projects/${templateId}`)
- Create a ticketCreate a ticket
Function ProjectReport
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ProjectReport = () => {
const { projectId } = useParams();
const [project, setProject] = useState(null);
useEffect(() => {
- Create a ticketCreate a ticket
Function KeyboardShortcuts
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const KeyboardShortcuts = () => {
const [modalVisible, setModalVisible] = useState(false);
const onKeyDownListener = useCallback((ev) => {
if (isInputElement(document.activeElement)) {
- Create a ticketCreate a ticket
Function ExportForm
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ExportForm = () => {
const [entities] = useFetch('/system/exportables');
const [exportButtonDisabled, setExportButtonDisabled] = useState(true);
- Create a ticketCreate a ticket
Function VulnerabilityEdit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const VulnerabilityEdit = () => {
const { vulnerabilityId } = useParams();
const navigate = useNavigate();
- Create a ticketCreate a ticket
Function NotificationsBadge
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const NotificationsBadge = () => {
const [notifications, fetchNotifications] = useFetch('/notifications?status=unread');
const onMessageHandler = () => {
fetchNotifications();
- Create a ticketCreate a ticket
Function SystemHealthPage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SystemHealthPage = () => {
const wsContextData = useContext(WebsocketContext);
const [apiHealth] = useFetch('/system/health');
return <div>
- Create a ticketCreate a ticket
Function useAuth
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useAuth() {
const { setColorMode } = useColorMode();
const { i18n } = useTranslation();
const [isAuth, setIsAuth] = useState(KeyCloakService.IsAuthenticated);
- Create a ticketCreate a ticket
Function AuditLogList
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AuditLogList = () => {
const navigate = useNavigate();
const query = useQuery();
let pageNumber = query.get('page');
pageNumber = pageNumber !== null ? parseInt(pageNumber) : 1;
- Create a ticketCreate a ticket
Function App
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const App = () => {
const { user } = useAuth();
const [theme, setTheme] = useState(user?.preferences?.['web-client.theme'] || 'dark');
- Create a ticketCreate a ticket
Function useDelete
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
const useDelete = (endpoint, successCallback = null, confirmationMessage = `Do you really want to delete this item?`, deleteMessage = 'The item has been deleted.') => {
return async (id) => {
if (window.confirm(confirmationMessage)) {
try {
- 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 VulnerabilityCreate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const VulnerabilityCreate = () => {
const navigate = useNavigate();
const query = useQuery();
const urlProjectId = useRef(query.get("projectId") || 0);
const isTemplate = "true" === query.get("isTemplate");
- Create a ticketCreate a ticket
Function connectTerminal
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const connectTerminal = () => {
const agentServiceProtocol = Configuration.isSecureTransportEnabled() ? 'wss' : 'ws';
const agentServiceHostPort = Configuration.getAgentServiceHostPort();
const webSocket = new WebSocket(`${agentServiceProtocol}://${agentServiceHostPort}/term?token=` + user.access_token);
webSocket.binaryType = 'arraybuffer';
- Create a ticketCreate a ticket
Function ClientCreate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ClientCreate = () => {
const navigate = useNavigate();
const [newClient, setNewClient] = useState(Client);
const onFormSubmit = async (ev) => {
- Create a ticketCreate a ticket
Function SystemIntegrationsPage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SystemIntegrationsPage = () => {
const [integrations] = useFetch('/system/integrations')
return <div>
<PageTitle value="Integrations" />
- Create a ticketCreate a ticket