From 1bf8ca1e5dd705c74b64ded49e6018001ef1efa2 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 14 Jul 2023 10:51:18 -0400 Subject: [PATCH 1/6] FIX: Permit electrodes.tsv in meg directories --- bids-validator/bids_validator/rules/file_level_rules.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bids-validator/bids_validator/rules/file_level_rules.json b/bids-validator/bids_validator/rules/file_level_rules.json index 83f3fd4e8..a220fcb5c 100644 --- a/bids-validator/bids_validator/rules/file_level_rules.json +++ b/bids-validator/bids_validator/rules/file_level_rules.json @@ -488,6 +488,8 @@ "_events\\.tsv", "_channels\\.json", "_channels\\.tsv", + "_electrodes\\.json", + "_electrodes\\.tsv", "_meg\\.json", "_coordsystem\\.json", "_photo\\.jpg", From 88c6c80446e42d1304650cfb5fcf977ca40fea32 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 10 Aug 2023 16:07:11 -0400 Subject: [PATCH 2/6] SCHEMA: When multiple sidecars match, accept exact matches --- bids-validator/src/schema/context.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bids-validator/src/schema/context.ts b/bids-validator/src/schema/context.ts index 22ccdcee6..7346aad31 100644 --- a/bids-validator/src/schema/context.ts +++ b/bids-validator/src/schema/context.ts @@ -131,8 +131,16 @@ export class BIDSContext implements Context { }) if (validSidecars.length > 1) { - // two matching in one dir not allowed - } else if (validSidecars.length === 1) { + const exactMatch = validSidecars.find(sidecar => sidecar.path == this.file.path.replace(this.extension, ".json")); + if (exactMatch) { + validSidecars.splice(1); + validSidecars[0] = exactMatch; + } else { + logger.warning(`Multiple sidecar files detected for '${this.file.path}'`) + } + } + + if (validSidecars.length === 1) { const json = await validSidecars[0] .text() .then((text) => JSON.parse(text)) From 6bfe4779539e77242a54f5f0205fa96a41d28695 Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Mon, 21 Aug 2023 15:06:46 -0700 Subject: [PATCH 3/6] fix: Prevent leaking private BIDSFileDeno fields in json output --- bids-validator/src/files/deno.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bids-validator/src/files/deno.ts b/bids-validator/src/files/deno.ts index 452743ee9..ca15c4358 100644 --- a/bids-validator/src/files/deno.ts +++ b/bids-validator/src/files/deno.ts @@ -25,10 +25,10 @@ export class BIDSFileDeno implements BIDSFile { name: string path: string #fileInfo?: Deno.FileInfo - private _datasetAbsPath: string + #datasetAbsPath: string constructor(datasetPath: string, path: string, ignore: FileIgnoreRules) { - this._datasetAbsPath = datasetPath + this.#datasetAbsPath = datasetPath this.path = path this.name = basename(path) this.#ignore = ignore @@ -42,7 +42,7 @@ export class BIDSFileDeno implements BIDSFile { } private _getPath(): string { - return join(this._datasetAbsPath, this.path) + return join(this.#datasetAbsPath, this.path) } get size(): number { From 604198daad8732ea109b44147aebfc11cbb57523 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 4 Aug 2023 13:58:49 -0400 Subject: [PATCH 4/6] DOC: Add usage instructions for running from deno.land --- bids-validator/src/README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bids-validator/src/README.md b/bids-validator/src/README.md index 1280c7aca..c0b601bfe 100644 --- a/bids-validator/src/README.md +++ b/bids-validator/src/README.md @@ -8,9 +8,25 @@ Deno is a JavaScript and TypeScript runtime that is used to run the schema based At the root of the repository there are two directories, `bids-validator` and `bids-validator-web`. These are separate npm packages, the Deno validator lives within the bids-validator package within the `src` directory. -## Schema validator examples +## Usage -Deno by default sandboxes applications like a web browser. To validate datasets located on your local system, you need to use the --allow-read flag to read local files. --allow-env is also required to allow for detection of OS specific features. These flags are included in the script line of the `./bids-validator-deno` script. +To use the latest validator hosted at https://deno.land/x/bids_validator, use the following command: + +```console +$ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-validator.ts path/to/dataset +``` + +Deno by default sandboxes applications like a web browser. `--allow-read` allows the validator to read local files, and `--allow-env` enables OS-specific features. + +By default only schema derived validation rules are run. The legacy validator can be run at the same time with `--legacy` and this may improve coverage for issues not yet implemented in the schema variant. + +```shell +$ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-validator.ts --legacy path/to/dataset +``` + +### Development tools + +From the repository root, use `bids-validator/bids-validator-deno` to run with all permissions enabled by default: ```shell # Run from within the /bids-validator directory @@ -19,7 +35,7 @@ cd bids-validator ./bids-validator-deno path/to/dataset ``` -By default only schema derived validation rules are run. The legacy validator can be run at the same time with `--legacy` and this may improve coverage for issues not yet implemented in the schema variant. +Additional flags may be passed, such as `--legacy`: ```shell ./bids-validator-deno --legacy path/to/dataset From 2af823b8761287a8038667eb8aca8c4c2f103b2e Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 24 Aug 2023 13:28:30 -0400 Subject: [PATCH 5/6] Update bids-validator/src/README.md Co-authored-by: Nell Hardcastle --- bids-validator/src/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/bids-validator/src/README.md b/bids-validator/src/README.md index c0b601bfe..1a5b463c4 100644 --- a/bids-validator/src/README.md +++ b/bids-validator/src/README.md @@ -18,7 +18,6 @@ $ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-vali Deno by default sandboxes applications like a web browser. `--allow-read` allows the validator to read local files, and `--allow-env` enables OS-specific features. -By default only schema derived validation rules are run. The legacy validator can be run at the same time with `--legacy` and this may improve coverage for issues not yet implemented in the schema variant. ```shell $ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-validator.ts --legacy path/to/dataset From 04d3fd2a7ee42f886fd66b0509d819d78cdce5d0 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 24 Aug 2023 13:30:39 -0400 Subject: [PATCH 6/6] DOC: Delegacify --- bids-validator/src/README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/bids-validator/src/README.md b/bids-validator/src/README.md index 1a5b463c4..c9c00d5a9 100644 --- a/bids-validator/src/README.md +++ b/bids-validator/src/README.md @@ -18,11 +18,6 @@ $ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-vali Deno by default sandboxes applications like a web browser. `--allow-read` allows the validator to read local files, and `--allow-env` enables OS-specific features. - -```shell -$ deno run --allow-read --allow-env https://deno.land/x/bids_validator/bids-validator.ts --legacy path/to/dataset -``` - ### Development tools From the repository root, use `bids-validator/bids-validator-deno` to run with all permissions enabled by default: @@ -34,12 +29,6 @@ cd bids-validator ./bids-validator-deno path/to/dataset ``` -Additional flags may be passed, such as `--legacy`: - -```shell -./bids-validator-deno --legacy path/to/dataset -``` - ## Schema validator test suite ```shell