Skip to content

Commit 79073f5

Browse files
committed
Solve sonar issue parseInt
Signed-off-by: freddidierRTE <[email protected]>
1 parent 7e453f0 commit 79073f5

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

backend/cards-external-diffusion/src/domain/application/handlebarsHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ export class HandlebarsHelper {
327327
private static registerDateFormat(): void {
328328
Handlebars.registerHelper('dateFormat', function (value: string | number, options) {
329329
if (typeof value === 'string') {
330-
value = parseInt(value);
330+
value = Number.parseInt(value);
331331
}
332332
const m = new Date(value);
333333
const tz = HandlebarsHelper._timezone || 'UTC';

frontend/src/app/builtInTemplates/task/usercard/TaskUserCardTemplate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,10 @@ export class TaskUserCardTemplate extends BaseUserCardTemplate {
541541

542542
getSpecificCardInformation() {
543543
const time = (<HTMLInputElement>document.getElementById('time')).value;
544-
const durationInMinutes: number = parseInt(
544+
const durationInMinutes: number = Number.parseInt(
545545
(<HTMLInputElement>document.getElementById('durationInMinutes')).value
546546
);
547-
let minutesForReminder: number = parseInt(
547+
let minutesForReminder: number = Number.parseInt(
548548
(<HTMLInputElement>document.getElementById('minutesForReminder')).value
549549
);
550550
if (minutesForReminder == null || isNaN(minutesForReminder)) {
@@ -577,7 +577,7 @@ export class TaskUserCardTemplate extends BaseUserCardTemplate {
577577

578578
if ((<HTMLInputElement>document.getElementById('radioButtonNthDay')).checked === true) {
579579
if ((<HTMLInputElement>document.getElementById('nthDay')).value) {
580-
const nthDay = parseInt((<HTMLInputElement>document.getElementById('nthDay')).value);
580+
const nthDay = Number.parseInt((<HTMLInputElement>document.getElementById('nthDay')).value);
581581
bymonthday.push(nthDay);
582582
}
583583
if ((<HTMLInputElement>document.getElementById('firstDay')).checked === true) {
@@ -599,7 +599,7 @@ export class TaskUserCardTemplate extends BaseUserCardTemplate {
599599

600600
if ((<HTMLInputElement>document.getElementById('radioButtonNthWeekday')).checked === true) {
601601
bysetpos = this.occurrenceNumberSelect.getSelectedValues().map((selectedValue) => {
602-
return parseInt(selectedValue);
602+
return Number.parseInt(selectedValue);
603603
});
604604
if (this.weekdaySelect.getSelectedValues().length > 0) {
605605
byweekday = [this.weekdaySelect.getSelectedValues()];

frontend/src/app/builtInTemplates/task/usercard/TaskUserCardTemplateView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export class TaskUserCardTemplateView {
2424
) {
2525
let byhour, byminute;
2626
if (time) {
27-
byhour = [parseInt(time.slice(0, 2))]; // the hours are the 2 first characters
28-
byminute = [parseInt(time.slice(-2))]; // the minutes are the 2 last characters
27+
byhour = [Number.parseInt(time.slice(0, 2))]; // the hours are the 2 first characters
28+
byminute = [Number.parseInt(time.slice(-2))]; // the minutes are the 2 last characters
2929
}
3030

3131
let rRule;

frontend/src/app/components/archives/ArchivesComponent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export class ArchivesComponent implements OnDestroy, OnInit {
138138
this.isCollapsibleUpdatesActivated = isCollapsibleUpdatesActivatedInStorage === 'true';
139139

140140
const savedPageSize = UserPreferencesService.getPreference('opfab.archives.page.size');
141-
if (savedPageSize) this.pageSize = parseInt(savedPageSize);
142-
this.historySize = parseInt(ConfigService.getConfigValue('archive.history.size', 100));
141+
if (savedPageSize) this.pageSize = Number.parseInt(savedPageSize);
142+
this.historySize = Number.parseInt(ConfigService.getConfigValue('archive.history.size', 100));
143143
BusinessConfigAPI.getTags('archive').then((customTags) => {
144144
this.tags = customTags ?? ConfigService.getConfigValue('archive.filters.tags.list');
145145
this.changeDetector.markForCheck();

frontend/src/app/components/customCardList/CustomCardListComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class CustomCardListComponent implements OnInit, OnDestroy {
185185
this.readAndAckSelected = this.customCardListView.getDefaultSelectedReadAndAck();
186186

187187
const savedPageSize = UserPreferencesService.getPreference('opfab.customScreens.page.size');
188-
if (savedPageSize) this.pageSize = parseInt(savedPageSize);
188+
if (savedPageSize) this.pageSize = Number.parseInt(savedPageSize);
189189
this.listenForLoadingInProcess();
190190
this.setFiltersVisibility();
191191
this.setInitialBusinessPeriod();

frontend/src/app/components/logging/LoggingComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class LoggingComponent implements OnDestroy, OnInit, AfterViewInit {
132132

133133
ngOnInit() {
134134
const savedPageSize = UserPreferencesService.getPreference('opfab.archives.page.size');
135-
if (savedPageSize) this.pageSize = parseInt(savedPageSize);
135+
if (savedPageSize) this.pageSize = Number.parseInt(savedPageSize);
136136
BusinessConfigAPI.getTags('logging').then((customTags) => {
137137
this.tags = customTags ?? ConfigService.getConfigValue('logging.filters.tags.list');
138138
this.changeDetector.markForCheck();

frontend/src/app/components/useractionlogs/UserActionLogsComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class UserActionLogsComponent implements OnInit, OnDestroy {
9494

9595
ngOnInit() {
9696
const savedPageSize = UserPreferencesService.getPreference('opfab.useractionlogs.page.size');
97-
if (savedPageSize) this.pageSize = parseInt(savedPageSize);
97+
if (savedPageSize) this.pageSize = Number.parseInt(savedPageSize);
9898
this.initForm();
9999
this.setInitialDateFrom();
100100
this.initActionMultiselect();

frontend/src/app/services/handlebars/HandlebarsHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export class HandlebarsHelper {
314314
private static registerDateFormat() {
315315
Handlebars.registerHelper('dateFormat', (value, options) => {
316316
if (typeof value == 'string') {
317-
value = parseInt(value);
317+
value = Number.parseInt(value);
318318
}
319319
const m = new Date(value);
320320
return format(m, options.hash.format, this.getDateFnsLocaleOption(HandlebarsHelper._locale));

0 commit comments

Comments
 (0)