RocketChat/Rocket.Chat

View on GitHub

Showing 9,144 of 9,144 total issues

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

export const useComposerBoxPopupQueries = <T extends { _id: string; sort?: number }>(filter: unknown, popup?: ComposerPopupOption<T>) => {
    const [counter, setCounter] = useState(0);

    useEffect(() => {
        setCounter(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 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 useMessageComposerMergedRefs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useMessageComposerMergedRefs = <T>(...refs: Ref<T>[]): RefCallback<T> => {
    return useCallback((refValue: T) => {
        refs.filter(Boolean).forEach((ref) => {
            if (isRefCallback<T>(ref)) {
                ref(refValue);

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

export const useE2EERoomState = (rid: string) => {
    const e2eRoom = useE2EERoom(rid);

    const subscribeE2EERoomState = useMemo(
        () =>
Severity: Minor
Found in apps/meteor/client/views/room/hooks/useE2EERoomState.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 SidebarFooterWatermark has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const SidebarFooterWatermark = (): ReactElement | null => {
    const t = useTranslation();

    const response = useLicense();

Severity: Minor
Found in apps/meteor/client/sidebarv2/footer/SidebarFooterWatermark.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 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 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 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 StringSettingInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function StringSettingInput({
    _id,
    label,
    name,
    disabled,

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 dispatchToastMessage = useToastMessageDispatch();
    const queryClient = useQueryClient();

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

export const useArchiveRoom = (room: Pick<IRoom, RoomAdminFieldsType>) => {
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();
    const archiveAction = useEndpoint('POST', '/v1/rooms.changeArchivationState');

Severity: Minor
Found in apps/meteor/client/views/hooks/roomActions/useArchiveRoom.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 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 PlanCardTrial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const PlanCardTrial = ({ licenseInformation }: PlanCardProps): ReactElement => {
    const { t } = useTranslation();

    const planName = useLicenseName();
    const isSalesAssisted = licenseInformation.grantedBy?.method !== 'self-service' || true;

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 = ({ onClick, reload }: CustomEmojiProps) => {
    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 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 DeploymentCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const DeploymentCard = ({ serverInfo: { info, cloudWorkspaceId }, 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 AdminUserSetRandomPasswordContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AdminUserSetRandomPasswordContent = ({
    control,
    setRandomPassword,
    isNewUserPage,
    passwordId,

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

const Header = ({ room }: HeaderProps): ReactElement | null => {
    const { isMobile, isEmbedded, showTopNavbarEmbeddedLayout } = useLayout();
    const encrypted = Boolean(room.encrypted);
    const unencryptedMessagesAllowed = useSetting<boolean>('E2E_Allow_Unencrypted_Messages');
    const shouldDisplayE2EESetup = encrypted && !unencryptedMessagesAllowed;
Severity: Minor
Found in apps/meteor/client/views/room/HeaderV2/Header.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

Severity
Category
Status
Source
Language