RocketChat/Rocket.Chat

View on GitHub

Showing 9,144 of 9,144 total issues

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

const TagEdit = ({ tagData, currentDepartments }: TagEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const queryClient = useQueryClient();
    const handleDeleteTag = useRemoveTag();
Severity: Minor
Found in apps/meteor/client/omnichannel/tags/TagEdit.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 EditStatusModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const EditStatusModal = ({ onClose, userStatus, userStatusText }: EditStatusModalProps): ReactElement => {
    const allowUserStatusMessageChange = useSetting('Accounts_AllowUserStatusMessageChange');
    const dispatchToastMessage = useToastMessageDispatch();
    const [customStatus, setCustomStatus] = useLocalStorage<string | undefined>('Local_Custom_Status', '');
    const initialStatusText = customStatus || userStatusText;
Severity: Minor
Found in apps/meteor/client/sidebar/header/EditStatusModal.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 updateSubscription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public updateSubscription(subscription?: ISubscription) {
        if (!subscription) {
            return;
        }

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

    private validateRoute<TRouteName extends RouteName>(route: IRoomTypeRouteConfig<TRouteName>): void {
        const { name, path, link } = route;

        if (typeof name !== 'string' || name.length === 0) {
            throw new Error('The route name must be a string.');
Severity: Minor
Found in apps/meteor/client/lib/rooms/roomCoordinator.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 parseMessageTextToAstMarkdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const parseMessageTextToAstMarkdown = <
    TMessage extends IMessage & Partial<ITranslatedMessage> = IMessage & Partial<ITranslatedMessage>,
>(
    message: TMessage,
    parseOptions: Options,
Severity: Minor
Found in apps/meteor/client/lib/parseMessageTextToAstMarkdown.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 delegate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const delegate = ({
    parent = document,
    eventName,
    elementSelector,
    listener,
Severity: Minor
Found in apps/meteor/client/lib/utils/domEvents.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 mapRolesFromSSO has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    static async mapRolesFromSSO(identity: Record<string, any>, roleClaimName: string): Promise<string[]> {
        if (!identity || !roleClaimName || !identity[roleClaimName] || !Array.isArray(identity[roleClaimName])) {
            return [];
        }

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

export const SidebarFooterWatermark = (): ReactElement | null => {
    const t = useTranslation();

    const response = useLicense();

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

export const appEnableCheck = async ({
    baseUrl,
    headers,
    appId,
    version,
Severity: Minor
Found in apps/meteor/ee/server/apps/marketplace/appEnableCheck.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 checkPlaceholdersFormat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const checkPlaceholdersFormat = async ({ json, path, fix = false }: { json: Record<string, string>; path: PathLike; fix?: boolean }) => {
    const outdatedKeys = Object.entries(json)
        .map(([key, value]) => ({
            key,
            value,
Severity: Minor
Found in apps/meteor/.scripts/translation-check.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 copyActiveState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static copyActiveState(ldapUser: ILDAPEntry, userData: IImportUser): void {
        if (!ldapUser) {
            return;
        }

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

const checkExceedingKeys = async ({
    json,
    path,
    lng,
    sourceJson,
Severity: Minor
Found in apps/meteor/.scripts/translation-check.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 extractSingularKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const extractSingularKeys = (json: Record<string, string>, lng: string) => {
    if (!i18next.isInitialized) {
        i18next.init({ initImmediate: false });
    }

Severity: Minor
Found in apps/meteor/.scripts/translation-check.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 getLivechatQueueInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getLivechatQueueInfo = async (room?: IOmnichannelRoom) => {
    if (!room) {
        return null;
    }

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

export function changeSettingValue(record: ISetting): SettingValue {
    if (!record.enterprise) {
        return record.value;
    }

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

    private async removeBHFromPreviouslyConnectedDepartmentAgentsIfRequired(departmentIds: string[]): Promise<void> {
        // we need to do 2 things here.
        // 1st is to check if any of the departments are associated with any BH. If they are, then we need to remove
        // that BH from all agents of that department.
        // 2nd is to check if any of the departments are not associated with BH, meaning default BH
Severity: Minor
Found in apps/meteor/ee/app/livechat-enterprise/server/business-hour/Custom.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 started has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async started(): Promise<void> {
        // TODO this call creates a dependency to MeteorService, should it be a hard dependency? or can this call fail and be ignored?
        try {
            const versions = await MeteorService.getAutoUpdateClientVersions();

Severity: Minor
Found in ee/apps/ddp-streamer/src/DDPStreamer.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        async post() {
            const { _id: triggerId } = this.urlParams;
            const { token: visitorToken, extraData } = this.bodyParams;

            const trigger = await LivechatTrigger.findOneById(triggerId);
Severity: Minor
Found in apps/meteor/ee/app/livechat-enterprise/server/api/triggers.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async call(client: Client, packet: IPacket): Promise<void> {
        // if client is not connected we don't need to do anything
        if (client.ws.readyState !== WebSocket.OPEN) {
            return;
        }
Severity: Minor
Found in ee/apps/ddp-streamer/src/Server.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 handleOnAgentAssignmentFailed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const handleOnAgentAssignmentFailed = async (
    room: IOmnichannelRoom,
    {
        inquiry,
        options,

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