Showing 3,448 of 8,947 total issues
Function MeetPage
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MeetPage = () => {
const t = useTranslation();
const [isRoomMember, setIsRoomMember] = useState(false);
const [status, setStatus] = useState(null);
const [visitorId, setVisitorId] = useState(null);
File Utils.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { EventEmitter } from 'events';
import zlib from 'zlib';
import type { Logger } from '@rocket.chat/logger';
E2ERoom
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
export class E2ERoom extends Emitter {
state = undefined;
[PAUSED] = undefined;
TeamService
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
export class TeamService extends ServiceClassInternal implements ITeamService {
protected name = 'team';
async create(uid: string, { team, room = { name: team.name, extraData: {} }, members, owner }: ITeamCreateParams): Promise<ITeam> {
if (!(await checkUsernameAvailability(team.name))) {
Function processFilesForTarget
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
async processFilesForTarget(files) {
const processVersionFile = async function (file) {
const data = await new Promise((resolve, reject) => {
const currentVersion =
JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.version || '';
- 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 updateIncomingIntegration
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
async updateIncomingIntegration(integrationId, integration) {
if (!this.userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'updateOutgoingIntegration',
});
- 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 registerContact
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
async registerContact({
token,
name,
email = '',
phone,
- 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 deleteUser
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export async function deleteUser(userId: string, confirmRelinquish = false, deletedBy?: IUser['_id']): Promise<void> {
if (userId === 'rocket.cat') {
throw new Meteor.Error('error-action-not-allowed', 'Deleting the rocket.cat user is not allowed', {
method: 'deleteUser',
action: 'Delete_user',
- 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 mapSSOGroupsToChannels
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
static async mapSSOGroupsToChannels(
user: IUser,
identity: Record<string, any>,
groupClaimName: string,
channelsMap: Record<string, any> | undefined,
- 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 index.js
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Apps, AppEvents } from '@rocket.chat/apps';
import { User } from '@rocket.chat/core-services';
import { Roles, Settings, Users } from '@rocket.chat/models';
import { escapeRegExp, escapeHTML } from '@rocket.chat/string-helpers';
import { getLoginExpirationInDays } from '@rocket.chat/tools';
File LivechatVisitors.ts
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { ILivechatVisitor, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { FindPaginated, ILivechatVisitorsModel } from '@rocket.chat/model-typings';
import { Settings } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type {
Function SubscriptionPage
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SubscriptionPage = () => {
const showLicense = useShowLicense();
const router = useRouter();
const { data: enterpriseData } = useIsEnterprise();
const { isRegistered } = useRegistrationStatus();
File cookies.js
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Meteor } from 'meteor/meteor';
let fetch;
let WebApp;
Function ResetPasswordPage
has 129 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ResetPasswordPage = (): ReactElement => {
const user = useUser();
const t = useTranslation();
const setUserPassword = useMethod('setUserPassword');
const resetPassword = useMethod('resetPassword');
File general.ts
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { settingsRegistry } from '../../app/settings/server';
export const createGeneralSettings = () =>
settingsRegistry.addGroup('General', async function () {
await this.section('REST API', async function () {
Function AdminUsersPage
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AdminUsersPage = (): ReactElement => {
const t = useTranslation();
const seatsCap = useSeatsCap();
File Response.ts
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
import xmldom from '@xmldom/xmldom';
import xmlCrypto from 'xml-crypto';
import xmlenc from 'xml-encryption';
import type { ISAMLAssertion } from '../../definition/ISAMLAssertion';
Function codeblocks
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const codeblocks = (message) => {
// Count occurencies of ```
const count = (message.html.match(/```/gm) || []).length;
if (count) {
- 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 loginHandlerCAS
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
export const loginHandlerCAS = async (options: any): Promise<undefined | Accounts.LoginMethodResult> => {
if (!options.cas) {
return undefined;
}
- 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 _initAuth
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected _initAuth(): void {
const loginCompatibility = (bodyParams: Record<string, any>, request: Request): Record<string, any> => {
// Grab the username or email that the user is logging in with
const { user, username, email, password, code: bodyCode } = bodyParams;
let usernameToLDAPLogin = '';
- 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"