Showing 3,268 of 8,229 total issues
Function constructor
has 375 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(service: IServiceClass, notifications: NotificationsModule) {
const logger = new Logger('ListenersModule');
service.onEvent('license.sync', () => notifications.notifyAllInThisInstance('license'));
service.onEvent('license.actions', () => notifications.notifyAllInThisInstance('license'));
Function createGeneralSettings
has 375 lines of code (exceeds 25 allowed). Consider refactoring. Open
settingsRegistry.addGroup('General', async function () {
await this.section('REST API', async function () {
await this.add('API_Upper_Count_Limit', 100, { type: 'int', public: false });
await this.add('API_Default_Count', 50, { type: 'int', public: false });
await this.add('API_Allow_Infinite_Count', true, { type: 'boolean', public: false });
Function createMessageSettings
has 365 lines of code (exceeds 25 allowed). Consider refactoring. Open
settingsRegistry.addGroup('Message', async function () {
await this.section('Message_Attachments', async function () {
await this.add('Message_Attachments_Thumbnails_Enabled', true, {
type: 'boolean',
public: true,
File accounts.ts
has 767 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Random } from '@rocket.chat/random';
import { settingsRegistry } from '../../app/settings/server';
export const createAccountSettings = () =>
Function AppearanceForm
has 341 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AppearanceForm = () => {
const t = useTranslation();
const isEnterprise = useHasLicenseModule('livechat-enterprise');
const { control, watch } = useFormContext();
Function ComposerPopupProvider
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
const ComposerPopupProvider = ({ children, room }: { children: ReactNode; room: IRoom }) => {
const { _id: rid } = room;
const userSpotlight = useMethod('spotlight');
const suggestionsCount = useSetting<number>('Number_of_users_autocomplete_suggestions');
const cannedResponseEnabled = useSetting<boolean>('Canned_Responses_Enable');
- Read upRead up
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
File RoomServiceReceiver.ts
has 722 lines of code (exceeds 250 allowed). Consider refactoring. Open
// TODO: Refactor this file splitting it into smaller files + removing the complexity of the most important method (changeMembership)
import { RoomType } from '@rocket.chat/apps-engine/definition/rooms';
import { isDirectMessageRoom, isQuoteAttachment } from '@rocket.chat/core-typings';
import { DirectMessageFederatedRoom, FederatedRoom } from '../../../domain/FederatedRoom';
File chat.ts
has 704 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Message } from '@rocket.chat/core-services';
import type { IMessage } from '@rocket.chat/core-typings';
import { Messages, Users, Rooms, Subscriptions } from '@rocket.chat/models';
import { isChatReportMessageProps, isChatGetURLPreviewProps } from '@rocket.chat/rest-typings';
import { escapeRegExp } from '@rocket.chat/string-helpers';
File VoIPUser.ts
has 702 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Class representing SIP UserAgent
* @remarks
* This class encapsulates all the details of sip.js and exposes
* a very simple functions and callback handlers to the outside world.
Function useComposerBoxPopup
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
export const useComposerBoxPopup = <T extends { _id: string; sort?: number }>({
configurations,
}: {
configurations: ComposerBoxPopupOptions<T>[];
}): ComposerBoxPopupResult<T> => {
- Read upRead up
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
File LivechatRooms.ts
has 684 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
ILivechatPriority,
IOmnichannelRoom,
IOmnichannelServiceLevelAgreements,
RocketChatRecordDeleted,
File Connection.ts
has 683 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
ILDAPConnectionOptions,
LDAPEncryptionType,
LDAPSearchScope,
ILDAPEntry,
File Agenda.ts
has 680 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { EventEmitter } from 'events';
import debugInitializer from 'debug';
import humanInterval from 'human-interval';
import { MongoClient } from 'mongodb';
Function MessageBox
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
const MessageBox = ({
tmid,
onSend,
onJoin,
onNavigateToNextMessage,
- Read upRead up
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 initWatchers
has 303 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initWatchers(watcher: DatabaseWatcher, broadcast: BroadcastCallback): void {
// watch for changes on the database and broadcast them to the other instances
if (!dbWatchersDisabled) {
watcher.on<IMessage>(Messages.getCollectionName(), async ({ clientAction, id, data }) => {
switch (clientAction) {
Function value
has 301 lines of code (exceeds 25 allowed). Consider refactoring. Open
const value: ComposerPopupContextValue = useMemo(() => {
return [
createMessageBoxPopupConfig({
trigger: '@',
title: t('People'),
File Bridge.ts
has 665 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { IMessage } from '@rocket.chat/core-typings';
import type { AppServiceOutput, Bridge } from '@rocket.chat/forked-matrix-appservice-bridge';
import { serverFetch as fetch } from '@rocket.chat/server-fetch';
import type { IExternalUserProfileInformation, IFederationBridge, IFederationBridgeRegistrationFile } from '../../domain/IFederationBridge';
Function createSettings
has 297 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createSettings = async (): Promise<void> => {
await settingsRegistry.add('Livechat_abandoned_rooms_action', 'none', {
type: 'select',
group: 'Omnichannel',
section: 'Sessions',
Function createFileUploadSettings
has 286 lines of code (exceeds 25 allowed). Consider refactoring. Open
settingsRegistry.addGroup('FileUpload', async function () {
await this.add('FileUpload_Enabled', true, {
type: 'boolean',
public: true,
});
Function useQuickActions
has 285 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useQuickActions = (): {
quickActions: QuickActionsActionConfig[];
actionDefault: (actionId: string) => void;
} => {
const room = useOmnichannelRoom();