RocketChat/Rocket.Chat

View on GitHub

Showing 8,320 of 8,320 total issues

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

function getFetchAgent(url: string, allowSelfSignedCerts?: boolean): http.Agent | https.Agent | null | HttpsProxyAgent | HttpProxyAgent {
    const isHttps = /^https/.test(url);

    const proxy = getProxyForUrl(url);
    if (proxy) {
Severity: Minor
Found in packages/server-fetch/src/index.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(config: AgendaConfig = {}) {
        super();

        this._name = config.name;
        this._processEvery = humanInterval(config.processEvery) || defaultInterval;
Severity: Minor
Found in packages/agenda/src/Agenda.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 _lockOnTheFly has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private async _lockOnTheFly(): Promise<void> {
        // Already running this? Return
        if (this._isLockingOnTheFly) {
            debug('lockOnTheFly() already running, returning');
            return;
Severity: Minor
Found in packages/agenda/src/Agenda.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 findAllAverageOfChatDurationTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    findAllAverageOfChatDurationTime({
        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 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 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 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 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 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

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

    public async sendMessageFileToThread(
        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

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

    public async sendReplyMessageFileToRoom(
        externalRoomId: string,
        externaSenderId: 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

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

export async function configureEmailInboxes(): Promise<void> {
    const emailInboxesCursor = EmailInbox.find({
        active: true,
    });

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

const userDataDownloadHandler = async (req: IncomingMessage, res: ServerResponse, next: () => void) => {
    const downloadEnabled = settings.get<boolean>('UserData_EnableDownload');
    if (!downloadEnabled) {
        res.writeHead(403).end();
        return;
Severity: Minor
Found in apps/meteor/server/routes/userDataDownload.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 uploadAttachment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

async function uploadAttachment(attachmentParam: Attachment, rid: string, visitorToken: string): Promise<Partial<FileAttachment>> {
    const details = {
        name: attachmentParam.filename,
        size: attachmentParam.size,
        type: attachmentParam.contentType,
Severity: Minor
Found in apps/meteor/server/features/EmailInbox/EmailInbox_Incoming.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 sendMessageFileToRoom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public async sendMessageFileToRoom(
        externalRoomId: string,
        externaSenderId: 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