Skip to content

Commit 2b8bea4

Browse files
CHORE SB Try to fix Sonar.
1 parent 8ad16e0 commit 2b8bea4

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

scripts/config/sonar-scanner.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sonar.qualitygate.wait=true
55
sonar.sourceEncoding=UTF-8
66
sonar.sources=src
77
sonar.coverage.exclusions=src/**/*.test.ts*, src/app/layout.tsx
8+
sonar.cpd.exclusions==src/**/*.test.ts*
89

910
#sonar.python.coverage.reportPaths=.coverage/coverage.xml
1011
sonar.typescript.lcov.reportPaths=lcov.info

src/utils/campaigns/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const CampaignSchema = z
1919
export type Campaign = z.infer<typeof CampaignSchema>;
2020

2121
export class Campaigns {
22-
private schedule: Partial<Record<VaccineType, Campaign[]>>;
22+
private readonly schedule: Partial<Record<VaccineType, Campaign[]>>;
2323

2424
constructor(schedule: Partial<Record<VaccineType, Campaign[]>>) {
2525
this.schedule = schedule;

src/utils/date.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export const UtcDateFromStringSchema = z
44
.string()
55
.regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format")
66
.transform((str, ctx) => {
7-
const year = parseInt(str.slice(0, 4));
8-
const month = parseInt(str.slice(5, 7)); // 1-indexed (01 = Jan)
9-
const day = parseInt(str.slice(8, 10));
7+
const year = Number.parseInt(str.slice(0, 4));
8+
const month = Number.parseInt(str.slice(5, 7)); // 1-indexed (01 = Jan)
9+
const day = Number.parseInt(str.slice(8, 10));
1010
const utcTimestamp = Date.UTC(year, month - 1, day);
1111
const date = new Date(utcTimestamp);
1212
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
@@ -21,7 +21,7 @@ export const UtcDateTimeFromStringSchema = z.iso
2121
.transform((str, ctx) => {
2222
const date = new Date(str);
2323

24-
if (isNaN(date.getTime())) {
24+
if (Number.isNaN(date.getTime())) {
2525
ctx.addIssue({ code: "custom", message: "Invalid date value" });
2626
return z.NEVER;
2727
}

0 commit comments

Comments
 (0)