RocketChat/Rocket.Chat

View on GitHub

Showing 3,299 of 8,337 total issues

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

const PlainSpan = ({ text }: PlainSpanProps): ReactElement => {
    const t = useTranslation();
    const { highlightRegex, markRegex } = useContext(MarkupInteractionContext);

    const content = useMemo(() => {
Severity: Minor
Found in packages/gazzodown/src/elements/PlainSpan.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 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 path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Router.prototype.path = function (pathDef, fields, queryParams) {
    if (this._routesMap[pathDef]) {
        pathDef = this._routesMap[pathDef].path;
    }

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

Router.prototype._invalidateTracker = function () {
    var self = this;
    this.safeToRun++;
    this._tracker.invalidate();
    // After the invalidation we need to flush to make changes imediately
Severity: Minor
Found in apps/meteor/packages/flow-router/client/router.js - 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 loadPostcssConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const loadPostcssConfig = async () => {
    if (loaded) {
        return;
    }

Severity: Minor
Found in apps/meteor/packages/rocketchat-postcss/build.js - 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 CodeBlock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CodeBlock = ({ lines = [], language }: CodeBlockProps): ReactElement => {
    const ref = useRef<HTMLElement>(null);

    const { highlightRegex } = useContext(MarkupInteractionContext);

Severity: Minor
Found in packages/gazzodown/src/code/CodeBlock.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 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 _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 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 Button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const Button = ({
    submit,
    form,
    disabled,
    outline,
Severity: Minor
Found in packages/livechat/src/components/Button/index.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function validate(options: CasOptions, ticket: string, callback: CasCallback, renew = false): void {
    if (!options.base_url) {
        throw new Error('Required CAS option `base_url` missing.');
    }

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

    shouldComponentUpdate(nextProps: RenderableProps<P>) {
        const { props } = this;

        for (const key in props) {
            if (props[key] !== nextProps[key]) {
Severity: Minor
Found in packages/livechat/src/helpers/MemoizedComponent.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 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 getBadgeText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getBadgeText = (badge: NonNullable<Badge>) => {
    if (typeof badge === 'number') {
        badge = Math.abs(badge | 0);

        if (badge > 999) {
Severity: Minor
Found in packages/favicon/src/badge.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 findPercentageOfAbandonedRooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async findPercentageOfAbandonedRooms({
        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 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 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 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 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

Severity
Category
Status
Source
Language