RocketChat/Rocket.Chat

View on GitHub

Showing 8,229 of 8,229 total issues

Function ImportHistoryPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function ImportHistoryPage() {
    const queryClient = useQueryClient();
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();

Severity: Minor
Found in apps/meteor/client/views/admin/import/ImportHistoryPage.tsx - About 25 mins 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 EditIncomingWebhook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const EditIncomingWebhook = ({ webhookData }: { webhookData?: Serialized<IIncomingIntegration> }) => {
    const t = useTranslation();
    const router = useRouter();
    const setModal = useSetModal();
    const tab = useRouteParameter('type');

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 HistoryItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const HistoryItem = ({ data }: { data: Serialized<IIntegrationHistory> }) => {
    const t = useTranslation();

    const replayOutgoingIntegration = useMethod('replayOutgoingIntegration');

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 formatQueuedAt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const formatQueuedAt = (room: IOmnichannelRoom) => {
    const { servedBy, closedAt, open, queuedAt, ts } = room || {};
    const queueStartedAt = queuedAt || ts;

    // Room served
Severity: Minor
Found in apps/meteor/client/views/omnichannel/directory/utils/formatQueuedAt.ts - About 25 mins 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 ModerationConsoleTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ModerationConsoleTable: FC = () => {
    const [text, setText] = useState('');
    const router = useRouter();
    const { t } = useTranslation();
    const isDesktopOrLarger = useMediaQuery('(min-width: 1024px)');
Severity: Minor
Found in apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx - About 25 mins 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 DeploymentCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const DeploymentCard = ({ serverInfo: { info }, statistics, instances }: DeploymentCardProps): ReactElement => {
    const t = useTranslation();
    const formatDateAndTime = useFormatDateAndTime();
    const setModal = useSetModal();

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 UsersInRolePage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const UsersInRolePage = ({ role }: { role: IRole }): ReactElement => {
    const t = useTranslation();
    const reload = useRef<() => void>(() => undefined);
    const dispatchToastMessage = useToastMessageDispatch();

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 ModerationConsolePage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ModerationConsolePage = ({ tab = 'messages', onSelectTab }: ModerationConsolePageProps) => {
    const t = useTranslation();
    const context = useRouteParameter('context');
    const id = useRouteParameter('id');
    const dispatchToastMessage = useToastMessageDispatch();
Severity: Minor
Found in apps/meteor/client/views/admin/moderation/ModerationConsolePage.tsx - About 25 mins 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 CustomEmoji has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CustomEmoji: FC<CustomEmojiProps> = ({ onClick, reload }) => {
    const t = useTranslation();

    const [text, setText] = useState('');
    const { sortBy, sortDirection, setSort } = useSort<'name'>('name');
Severity: Minor
Found in apps/meteor/client/views/admin/customEmoji/CustomEmoji.tsx - About 25 mins 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 RegisterWorkspaceTokenModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const RegisterWorkspaceTokenModal = ({ onClose, onStatusChange, ...props }: RegisterWorkspaceTokenModalProps) => {
    const setModal = useSetModal();
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();
    const connectWorkspace = useMethod('cloud:connectWorkspace');

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 ActiveSessionsPeakCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ActiveSessionsPeakCard = (): ReactElement => {
    const { t } = useTranslation();
    const { data, isLoading } = useStatistics();
    const formatDate = useFormatDate();

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 CustomSoundsTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CustomSoundsTable = ({ reload, onClick }: CustomSoundsTableProps) => {
    const t = useTranslation();
    const { sortBy, sortDirection, setSort } = useSort<'name'>('name');
    const { current, itemsPerPage, setItemsPerPage: onSetItemsPerPage, setCurrent: onSetCurrent, ...paginationProps } = usePagination();

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 UsersTableRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const UsersTableRow = ({ user, onClick, mediaQuery }: UsersTableRowProps): ReactElement => {
    const t = useTranslation();
    const { _id, emails, username, name, roles, status, active, avatarETag } = user;
    const statusText = active ? t(capitalize(status as string) as TranslationKey) : t('Disabled');

Severity: Minor
Found in apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx - About 25 mins 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 StringSettingInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function StringSettingInput({
    _id,
    label,
    name,
    disabled,
Severity: Minor
Found in apps/meteor/client/views/admin/settings/inputs/StringSettingInput.tsx - About 25 mins 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 AdminUserInfoActions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AdminUserInfoActions = ({
    username,
    userId,
    isFederatedUser,
    isActive,
Severity: Minor
Found in apps/meteor/client/views/admin/users/AdminUserInfoActions.tsx - About 25 mins 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 UserForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const UserForm = ({ userData, onReload, ...props }: AdminUserFormProps) => {
    const t = useTranslation();
    const router = useRouter();
    const dispatchToastMessage = useToastMessageDispatch();

Severity: Minor
Found in apps/meteor/client/views/admin/users/AdminUserForm.tsx - About 25 mins 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 OTR has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const OTR = ({ isOnline, onClickClose, onClickStart, onClickEnd, onClickRefresh, otrState, peerUsername }: OTRProps): ReactElement => {
    const t = useTranslation();

    const renderOTRState = (): ReactElement => {
        switch (otrState) {
Severity: Minor
Found in apps/meteor/client/views/room/contextualBar/OTR/OTR.tsx - About 25 mins 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 VideoConfConfigModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const VideoConfConfigModal = ({ onClose, onConfirm, isAdmin }: VideoConfConfigModalProps): ReactElement => {
    const t = useTranslation();

    return (
        <Modal>

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 useDropdownPosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const useDropdownPosition = (reference: RefObject<HTMLElement>, target: RefObject<HTMLElement>) => {
    const innerContainer = getDropdownContainer(reference.current);
    const viewHeight = document.body.getBoundingClientRect().height;
    const refTop = reference.current?.getBoundingClientRect().top ?? 0;
    const targetHeight = target.current?.getBoundingClientRect().height || 0;

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 getDropdownContainer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getDropdownContainer = (descendant: HTMLElement | null) => {
    for (let element = descendant ?? document.body; element !== document.body; element = element.parentElement ?? document.body) {
        if (
            getComputedStyle(element).transform !== 'none' ||
            getComputedStyle(element).position === 'fixed' ||

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

Severity
Category
Status
Source
Language