Showing 131 of 308 total issues
Function exportFile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async exportFile(data: any[], entityConstructor: EntityConstructor) {
const entitySchema = entityConstructor.schema;
const columnLabels = new Map<string, string>();
for (const [id, field] of entitySchema.entries()) {
Function anonymizeEntity
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async anonymizeEntity(entity: Entity): Promise<CascadingActionResult> {
if (!entity.getConstructor().hasPII) {
// entity types that are generally without PII by default retain all fields
// this should only be called through a cascade action anyway
return new CascadingActionResult();
Function generateIndexOnProperty
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateIndexOnProperty<
E extends Entity,
REF extends keyof E & string,
SEC extends keyof E & string,
>(
Function generateChildEntities
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateChildEntities(): Child[] {
const data = [];
const a1 = new Child("1");
a1.name = "Arjun A.";
Function withState
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static withState(
loginState = LoginState.LOGGED_IN,
data: Entity[] = [new User(TEST_USER)],
): ModuleWithProviders<MockedTestingModule> {
environment.session_type = SessionType.mock;
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(components: ComponentRegistry) {
components.addAll([
[
"Import",
() =>
Function testEntitySubclass
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function testEntitySubclass(
entityType: string,
entityClass: EntityConstructor,
expectedDatabaseFormat: any,
skipTestbedConfiguration = false,
Function generateChildSchoolRelationEntities
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateChildSchoolRelationEntities(): ChildSchoolRelation[] {
const data: ChildSchoolRelation[] = [];
const rel1: ChildSchoolRelation = new ChildSchoolRelation("1");
rel1.childId = "Child:1";
rel1.schoolId = "School:1";
Function generateAserResultsForChild
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private generateAserResultsForChild(child: Child): Aser[] {
const data = [];
let date = new Date(child.admissionDate.getTime());
let previousResult = new Aser("");
Function login
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async login(): Promise<SessionInfo> {
if (!this.keycloakInitialised) {
this.keycloakInitialised = true;
const loggedIn = await this.keycloak.init({
config: window.location.origin + "/assets/keycloak.json",
Function initSideDetails
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private async initSideDetails(
side: MatchingSideConfig,
sideIndex: number,
): Promise<MatchingSide> {
const newSide = Object.assign({}, side) as MatchingSide; // we are transforming it into this type here
- 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 getValidator
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private getValidator(
key: DynamicValidator,
value: any,
):
| { async?: false; fn: ValidatorFn }
- 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 getEntityTypesReferencingType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getEntityTypesReferencingType(type: string): {
entityType: EntityConstructor;
referencingProperties: string[];
}[] {
const referencingTypes = [];
- 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 handleDynamicMode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private handleDynamicMode(
formGroup: FormGroup,
fieldName: string,
defaultValueConfig: DefaultValueConfig,
isNew: boolean,
- 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 loadAttendanceOfAbsentees
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async loadAttendanceOfAbsentees() {
const previousMonday = moment()
.startOf("isoWeek")
.subtract(1, "week")
.add(this.daysOffset, "days");
Function getAttendanceReport
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getAttendanceReport(
attendances: AttendanceInfo[],
): AttendanceReport[] {
const participantMap: { [key in string]: AttendanceReport } = {};
attendances.forEach((attendance) => {
Function loadActivities
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async loadActivities() {
this.allActivities = await this.entityMapper
.loadType(RecurringActivity)
.then((res) => res.filter((a) => a.isActive));
Function drop
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
drop(event: CdkDragDrop<ColumnConfig[], ColumnConfig[]>) {
const prevFieldsArray = event.previousContainer.data;
const newFieldsArray = event.container.data;
if (
Function resizeImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function resizeImage(
file: File,
maxSize = 360,
): Promise<HTMLCanvasElement> {
const image = new Image();
Function icon
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Input() set icon(icon: string) {
if (!icon) {
this._icon = undefined;
return;
}