RocketChat/Rocket.Chat

View on GitHub

Showing 9,144 of 9,144 total issues

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

const AddUsers = ({ rid, onClickBack, reload }: AddUsersProps): ReactElement => {
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();
    const room = useRoom();

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

const TriggersRow = ({ _id, name, description, enabled, reload }: TriggersRowProps) => {
    const t = useTranslation();
    const setModal = useSetModal();
    const triggersRoute = useRoute('omnichannel-triggers');
    const deleteTrigger = useEndpoint('DELETE', '/v1/livechat/triggers/:_id', { _id });
Severity: Minor
Found in apps/meteor/client/views/omnichannel/triggers/TriggersRow.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 ChannelDesertionTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ChannelDesertionTable = ({
    rooms,
    eligibleRoomsLength,
    onChangeRoomSelection,
    selectedRooms,

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

const AttachmentImage = ({ id, previewUrl, dataSrc, loadImage = true, setLoadImage, src, ...size }: AttachmentImageProps) => {
    const limits = useAttachmentDimensions();

    const [error, setError] = useState(false);

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

const MessageToolbar = ({
    message,
    messageContext,
    room,
    subscription,
Severity: Minor
Found in apps/meteor/client/components/message/toolbar/MessageToolbar.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 reload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function reload() {
    const lastReload = localStorage.getItem(KEY);

    if (lastReload) {
        const last = Date.parse(lastReload);
Severity: Minor
Found in apps/meteor/client/serviceWorker.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 notifyNewMessageAudio has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function notifyNewMessageAudio(rid?: string): void {
    // This logic is duplicated in /client/startup/unread.coffee.
    const hasFocus = document.hasFocus();
    const messageIsInOpenedRoom = RoomManager.opened === rid;
    const muteFocusedConversations = getUserPreference(Meteor.userId(), 'muteFocusedConversations');
Severity: Minor
Found in apps/meteor/client/startup/notifications/konchatNotifications.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 UnitEdit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const UnitEdit = ({ unitData, unitMonitors, unitDepartments }: UnitEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const saveUnit = useMethod('livechat:saveUnit');
    const dispatchToastMessage = useToastMessageDispatch();
Severity: Minor
Found in apps/meteor/client/omnichannel/units/UnitEdit.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 useOutsideClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const useOutsideClick = (
    ref: RefObject<HTMLElement>,
    onDismiss: (() => void) | undefined,
): {
    onMouseDown: (e: MouseEvent) => void;
Severity: Minor
Found in apps/meteor/client/components/ModalBackdrop.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 CreateCannedResponseModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CreateCannedResponseModal = ({
    cannedResponseData,
    onClose,
    reloadCannedList,
}: {

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

export const PrioritiesSelect = ({ value = '', label, options, onChange }: PrioritiesSelectProps) => {
    const t = useTranslation();
    const hasLicense = useHasLicenseModule('livechat-enterprise');
    const [sorting] = useState<Record<string, LivechatPriorityWeight>>({});

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

    private onDirectCallJoined(params: DirectCallParams): void {
        if (!params.callId) {
            debug && console.log(`[VideoConf] Invalid 'video-conference.join' event received: ${params.callId}, ${params.uid}.`);
            return;
        }
Severity: Minor
Found in apps/meteor/client/lib/VideoConfManager.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 play has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    play(autoPlay = true, muteAudio = false): void {
        if (this.renderingMediaElement && this.mediaStream) {
            this.renderingMediaElement.autoplay = autoPlay;
            this.renderingMediaElement.srcObject = this.mediaStream;
            if (autoPlay) {
Severity: Minor
Found in apps/meteor/client/lib/voip/RemoteStream.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 MeetRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MeetRoute = () => {
    const router = useRouter();
    const dispatchToastMessage = useToastMessageDispatch();
    const { t } = useTranslation();

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

    public async joinCall(callId: string): Promise<void> {
        debug && console.log(`[VideoConf] Joining call ${callId}.`);

        if (this.incomingDirectCalls.has(callId)) {
            const data = this.incomingDirectCalls.get(callId);
Severity: Minor
Found in apps/meteor/client/lib/VideoConfManager.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 CannedResponseEdit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CannedResponseEdit = ({ cannedResponseData }: CannedResponseEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const dispatchToastMessage = useToastMessageDispatch();
    const queryClient = useQueryClient();
Severity: Minor
Found in apps/meteor/client/omnichannel/cannedResponses/CannedResponseEdit.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 onDirectCallAccepted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private onDirectCallAccepted(params: DirectCallParams, skipConfirmation = false): void {
        if (!params.callId || params.callId !== this.currentCallData?.callId) {
            debug && console.log(`[VideoConf] User ${params.uid} has accepted a call ${params.callId} from us, but we're not calling.`);
            return;
        }
Severity: Minor
Found in apps/meteor/client/lib/VideoConfManager.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 CannedResponseForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CannedResponseForm = () => {
    const t = useTranslation();
    const hasManagerPermission = usePermission('view-all-canned-responses');
    const hasMonitorPermission = usePermission('save-department-canned-responses');

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

    private onDirectCallEnded(params: DirectCallParams): void {
        if (!params.callId) {
            debug && console.log(`[VideoConf] Invalid 'video-conference.end' event received: ${params.callId}, ${params.uid}.`);
            return;
        }
Severity: Minor
Found in apps/meteor/client/lib/VideoConfManager.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

Severity
Category
Status
Source
Language