RocketChat/Rocket.Chat

View on GitHub

Showing 9,144 of 9,144 total issues

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

    getQueueMetrics({
        departmentId,
        agentId,
        includeOfflineAgents,
        options = {},
Severity: Minor
Found in apps/meteor/server/models/raw/LivechatRooms.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 findAllServiceTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    findAllServiceTime({
        start,
        end,
        departmentId,
        onlyCount = false,
Severity: Minor
Found in apps/meteor/server/models/raw/LivechatRooms.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 findRoomsByVisitorIdAndMessageWithCriteria has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    findRoomsByVisitorIdAndMessageWithCriteria({
        visitorId,
        searchText,
        open,
        served,
Severity: Minor
Found in apps/meteor/server/models/raw/LivechatRooms.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 subscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    subscribe(name: string, ...params: any[]) {
        const id = this.ddp.subscribe(name, params);

        // eslint-disable-next-line @typescript-eslint/no-this-alias
        const self = this;
Severity: Minor
Found in packages/ddp-client/src/ClientStream.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 core has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function core(m: number[], l: number) {
    const K = [
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be,
        0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0xfc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,
        0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x6ca6351, 0x14292967, 0x27b70a85,
Severity: Minor
Found in packages/sha256/src/core.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 utf8Encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function utf8Encode(input: string) {
    // METEOR change:
    // The webtoolkit.info version of this code added this
    // Utf8Encode function (which does seem necessary for dealing
    // with arbitrary Unicode), but the following line seems
Severity: Minor
Found in packages/sha256/src/utf8Encode.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 getCommitInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export async function getCommitInfo(request: { commit: string; repo: string; pr?: number }): Promise<{
    pull?: {
        number: number;
        url: string;
    };
Severity: Minor
Found in packages/release-changelog/src/getGitHubInfo.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 runFederation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

async function runFederation(): Promise<void> {
    // Get the settings
    const siteUrl = settings.get('Site_Url') as string;
    const { protocol } = new URL(siteUrl);
    const rocketChatProtocol = protocol.slice(0, -1);
Severity: Minor
Found in apps/meteor/server/cron/federation.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 updateSetting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

async function updateSetting(id: string, value: SettingValue | null): Promise<void> {
    if (value !== null) {
        const setting = settings.get(id);

        if (setting === undefined) {
Severity: Minor
Found in apps/meteor/server/cron/federation.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 sendMessageExternalServiceAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const sendMessageExternalServiceAction = async (
    triggerId: string,
    action: ILivechatUseExternalServiceAction,
    condition: ILivechatTriggerCondition,
) => {
Severity: Minor
Found in packages/livechat/src/lib/triggerActions.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 findAllNumberOfAbandonedRooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async findAllNumberOfAbandonedRooms({
        start,
        end,
        departmentId,
        onlyCount = false,
Severity: Minor
Found in apps/meteor/server/models/raw/LivechatRooms.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 registerGuest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    registerGuest: async (data: StoreState['guest']) => {
        if (typeof data !== 'object') {
            return;
        }

Severity: Minor
Found in packages/livechat/src/lib/hooks.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 findAllAverageWaitingTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    findAllAverageWaitingTime({
        start,
        end,
        departmentId,
        onlyCount = false,
Severity: Minor
Found in apps/meteor/server/models/raw/LivechatRooms.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 reducePlainTexts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const reducePlainTexts = (
  values: Paragraph['value']
): Paragraph['value'] =>
  values.flat().reduce((result, item, index, values) => {
    const next = values[index + 1];
Severity: Minor
Found in packages/message-parser/src/utils.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 deleteUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async deleteUser(userId, confirmRelinquish = false) {
        check(userId, String);
        const uid = Meteor.userId();
        if (!uid || (await hasPermissionAsync(uid, 'delete-user')) !== true) {
            throw new Meteor.Error('error-not-allowed', 'Not allowed', {
Severity: Minor
Found in apps/meteor/server/methods/deleteUser.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 loadSurroundingMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async loadSurroundingMessages(message, limit = 50) {
        check(message, Object);
        check(limit, Number);

        if (!Meteor.userId()) {
Severity: Minor
Found in apps/meteor/server/methods/loadSurroundingMessages.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 sendForgotPasswordEmail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async sendForgotPasswordEmail(to) {
        check(to, String);

        const email = to.trim().toLowerCase();

Severity: Minor
Found in apps/meteor/server/methods/sendForgotPasswordEmail.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 updateEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public async updateEvent(
        eventId: ICalendarEvent['_id'],
        { subject, description, startTime, meetingUrl, reminderMinutesBeforeStart, reminderTime }: Partial<ICalendarEvent>,
    ): Promise<UpdateResult> {
        return this.updateOne(
Severity: Minor
Found in apps/meteor/server/models/raw/CalendarEvent.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 loadNextMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async loadNextMessages(rid, end, limit = 20) {
        check(rid, String);
        check(limit, Number);

        if (!Meteor.userId()) {
Severity: Minor
Found in apps/meteor/server/methods/loadNextMessages.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 sendReplyMessageFileToThread has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public async sendReplyMessageFileToThread(
        externalRoomId: string,
        externalSenderId: string,
        content: Buffer,
        fileDetails: { filename: string; fileSize: number; mimeType: string; metadata?: { width?: number; height?: number; format?: string } },
Severity: Minor
Found in apps/meteor/server/services/federation/infrastructure/matrix/Bridge.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