From 7cea4011458130716d87e3c5971a0805e01ca1e1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 21:49:18 -0400 Subject: [PATCH 1/4] fix(context): Match directories with trailing slash to find sidecars --- bids-validator/src/schema/context.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bids-validator/src/schema/context.ts b/bids-validator/src/schema/context.ts index d7d0c37d0..7d4c8dccf 100644 --- a/bids-validator/src/schema/context.ts +++ b/bids-validator/src/schema/context.ts @@ -164,7 +164,7 @@ export class BIDSContext implements Context { this.sidecar = { ...this.sidecar, ...json } } const nextDir = fileTree.directories.find((directory) => { - return this.file.path.startsWith(directory.path) + return this.file.path.startsWith(`${directory.path}/`) }) if (nextDir) { await this.loadSidecar(nextDir) From 0b9a7523f82da6fb8797e6d23cd1750bb4483a41 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 22:02:49 -0400 Subject: [PATCH 2/4] chore(deno): Disable lock file where deno will respect it --- bids-validator/deno.json | 3 +-- deno.json | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 deno.json diff --git a/bids-validator/deno.json b/bids-validator/deno.json index 735c8c681..9323b8ca2 100644 --- a/bids-validator/deno.json +++ b/bids-validator/deno.json @@ -8,6 +8,5 @@ "singleQuote": true, "proseWrap": "preserve", "include": ["src/"] - }, - "lock": false + } } diff --git a/deno.json b/deno.json new file mode 100644 index 000000000..358b7d299 --- /dev/null +++ b/deno.json @@ -0,0 +1,3 @@ +{ + "lock": false +} From f2bab8726b086a3c9c9f6d7e188964d3fefcb691 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 22:20:17 -0400 Subject: [PATCH 3/4] fix(summary): Verify context.json is an object before looking up keys --- bids-validator/src/summary/summary.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bids-validator/src/summary/summary.ts b/bids-validator/src/summary/summary.ts index d30305604..e90a16a22 100644 --- a/bids-validator/src/summary/summary.ts +++ b/bids-validator/src/summary/summary.ts @@ -123,7 +123,7 @@ export class Summary { } if (context.extension === '.json') { - if ('TaskName' in context.json) { + if (typeof context.json === 'object' && 'TaskName' in context.json) { this.tasks.add(context.json.TaskName as string) } } From 9570834b3b917cbfa59a0a22c5e6892833b7f021 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 23:01:22 -0400 Subject: [PATCH 4/4] fix(context): Add file size to context, fixes README_FILE_SMALL --- bids-validator/src/schema/context.ts | 4 ++++ bids-validator/src/types/context.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/bids-validator/src/schema/context.ts b/bids-validator/src/schema/context.ts index d7d0c37d0..9cf817b0e 100644 --- a/bids-validator/src/schema/context.ts +++ b/bids-validator/src/schema/context.ts @@ -107,6 +107,10 @@ export class BIDSContext implements Context { this.associations = {} as ContextAssociations } + get size(): number { + return this.file.size + } + get path(): string { return this.file.path } diff --git a/bids-validator/src/types/context.ts b/bids-validator/src/types/context.ts index 4b47ef0cf..e9c1c7843 100644 --- a/bids-validator/src/types/context.ts +++ b/bids-validator/src/types/context.ts @@ -91,6 +91,7 @@ export interface Context { dataset: ContextDataset subject: ContextSubject path: string + size: number entities: object datatype: string suffix: string