Showing 3,448 of 8,947 total issues
Function onTestEnd
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
async onTestEnd(test: TestCase, result: TestResult) {
if (process.env.REPORTER_ROCKETCHAT_REPORT !== 'true') {
return;
}
File LivechatDepartment.ts
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { ILivechatDepartment, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { ILivechatDepartmentModel } from '@rocket.chat/model-typings';
import { LivechatDepartmentAgents, LivechatUnitMonitors } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
Function constructor
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options: StoreOptions) {
options = {
onCopyError: this.onCopyError,
onFinishUpload: this.onFinishUpload,
onRead: this.onRead,
File service.ts
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { IOmnichannelVoipService, FindVoipRoomsParams } from '@rocket.chat/core-services';
import { api, ServiceClassInternal, VoipAsterisk } from '@rocket.chat/core-services';
import type {
IVoipExtensionBase,
IVoipExtensionWithAgentInfo,
File license.ts
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
ILicenseTag,
LicenseEvents,
ILicenseV2,
ILicenseV3,
VideoConfManager
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
export const VideoConfManager = new (class VideoConfManager extends Emitter<VideoConfEvents> {
private userId: string | undefined;
private currentCallHandler: ReturnType<typeof setTimeout> | undefined;
Function LeaveMessage
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LeaveMessage: FunctionalComponent<{ path: string }> = () => {
const {
config: {
departments = [],
messages: { offlineMessage, offlineSuccessMessage, offlineUnavailableMessage },
Function onChangeRoomMembership
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async onChangeRoomMembership(roomChangeMembershipInput: FederationRoomChangeMembershipDto): Promise<void> {
const {
externalRoomId,
normalizedInviteeId,
normalizedRoomId,
Function PruneMessagesWithData
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PruneMessagesWithData = (): ReactElement => {
const t = useTranslation();
const room = useRoom();
const setModal = useSetModal();
const { closeTab: close } = useRoomToolbox();
Function saveUserProfile
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
async function saveUserProfile(
this: Meteor.MethodThisType,
settings: {
email?: string;
username?: string;
- 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 inviteAll
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
function inviteAll<T extends string>(type: T): SlashCommand<T>['callback'] {
return async function inviteAll({ command, params, message, userId }: SlashCommandCallbackParams<T>): Promise<void> {
if (!/invite\-all-(to|from)/.test(command)) {
return;
}
- 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 insertOrUpdateSAMLUser
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public static async insertOrUpdateSAMLUser(userObject: ISAMLUser): Promise<{ userId: string; token: string }> {
const {
generateUsername,
immutableProperty,
nameOverwrite,
- 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 RoomBody
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
const RoomBody = (): ReactElement => {
const chat = useChat();
if (!chat) {
throw new Error('No ChatContext provided');
}
- 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 compareBSONValues
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const compareBSONValues = (a: unknown, b: unknown): number => {
if (a === undefined) {
return b === undefined ? 0 : -1;
}
- 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 LivechatInquiry.ts
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
ILivechatInquiryRecord,
IMessage,
RocketChatRecordDeleted,
OmnichannelSortingMechanismSettingType,
Function onEmailReceived
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function onEmailReceived(email: ParsedMail, inbox: string, department = ''): Promise<void> {
logger.info(`New email conversation received on inbox ${inbox}. Will be assigned to department ${department}`);
if (!email.from?.value?.[0]?.address) {
return;
}
File saveUser.js
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Apps, AppEvents } from '@rocket.chat/apps';
import { isUserFederated } from '@rocket.chat/core-typings';
import { Users } from '@rocket.chat/models';
import Gravatar from 'gravatar';
import { Accounts } from 'meteor/accounts-base';
File ModerationReports.ts
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
IMessage,
IModerationAudit,
IModerationReport,
RocketChatRecordDeleted,
File MessageTypes.ts
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { MessageTypesValues as MessageTypesValuesType } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';
import { MessageTypes } from '../../ui-utils/lib/MessageTypes';
// import { callbacks } from '../../../lib/callbacks';
File OTRRoom.ts
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { IRoom, IMessage, IUser } from '@rocket.chat/core-typings';
import { UserStatus } from '@rocket.chat/core-typings';
import { Random } from '@rocket.chat/random';
import EJSON from 'ejson';
import { Meteor } from 'meteor/meteor';