RocketChat/Rocket.Chat

View on GitHub

Showing 9,144 of 9,144 total issues

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

export async function setSLAToInquiry({ userId, roomId, sla }: { userId: string; roomId: string; sla?: string }): Promise<void> {
    const inquiry = await LivechatInquiry.findOneByRoomId(roomId, { projection: { status: 1 } });
    if (!inquiry || inquiry.status !== 'queued') {
        throw new Error('error-invalid-inquiry');
    }
Severity: Minor
Found in apps/meteor/ee/app/livechat-enterprise/server/api/lib/inquiries.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 updatePriority has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export async function updatePriority(
    _id: string,
    data: Pick<ILivechatPriority, 'name'> & { reset?: boolean },
): Promise<ILivechatPriority | null> {
    if (data.name) {
Severity: Minor
Found in apps/meteor/ee/app/livechat-enterprise/server/api/lib/priorities.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 livechat:resumeOnHold has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async 'livechat:resumeOnHold'(roomId, options = { clientAction: false }) {
        methodDeprecationLogger.warn(
            'Method "livechat:resumeOnHold" is deprecated and will be removed in next major version. Please use "livechat/room.resumeOnHold" API instead.',
        );

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

export function replaceModules(this: LicenseManager, newModules: LicenseModule[]): boolean {
    let anyChange = false;
    for (const moduleName of newModules) {
        if (this.modules.has(moduleName)) {
            continue;
Severity: Minor
Found in ee/packages/license/src/modules.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