Function getUserDataMapping
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
public static getUserDataMapping(): IUserDataMap {
const { userDataFieldMap, immutableProperty } = globalSettings;
let map: Record<string, any>;
- 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 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';
Function getProfileValue
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public static getProfileValue(profile: Record<string, any>, mapping: IAttributeMapping, forceString = false): any {
const values: Record<string, string> = {
regex: '',
};
const fieldNames = ensureArray<string>(mapping.fieldName);
- 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 getUserDataMapping
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getUserDataMapping(): IUserDataMap {
const { userDataFieldMap, immutableProperty } = globalSettings;
let map: Record<string, any>;
SAMLUtils
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class SAMLUtils {
public static events: EventEmitter;
public static get isDebugging(): boolean {
return debug;
Function getProfileValue
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getProfileValue(profile: Record<string, any>, mapping: IAttributeMapping, forceString = false): any {
const values: Record<string, string> = {
regex: '',
};
const fieldNames = ensureArray<string>(mapping.fieldName);
Function mapProfileToUserObject
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static mapProfileToUserObject(profile: Record<string, any>): ISAMLUser {
const userDataMap = this.getUserDataMapping();
SAMLUtils.log('parsed userDataMap', userDataMap);
if (userDataMap.identifier.type === 'custom') {
- 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 mapProfileToUserObject
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static mapProfileToUserObject(profile: Record<string, any>): ISAMLUser {
const userDataMap = this.getUserDataMapping();
SAMLUtils.log('parsed userDataMap', userDataMap);
if (userDataMap.identifier.type === 'custom') {
Function updateGlobalSettings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static updateGlobalSettings(samlConfigs: Record<string, any>): void {
debug = Boolean(samlConfigs.debug);
globalSettings.generateUsername = Boolean(samlConfigs.generateUsername);
globalSettings.nameOverwrite = Boolean(samlConfigs.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 fillTemplateData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static fillTemplateData(template: string, data: Record<string, string>): string {
let newTemplate = template;
for (const variable in data) {
if (variable in data) {
- 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 validateStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static validateStatus(doc: Document): {
success: boolean;
message: string;
statusCode: 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"