Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pass custom config to validator #3184

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/openneuro-app/src/scripts/workers/schema.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
import { fileListToTree, validate } from "../utils/schema-validator.js"
import type { BIDSValidatorIssues } from "./worker-interface"

const config = {
error: [
{code: 'NO_AUTHORS'},
{code: 'SUBJECT_FOLDERS'}, // bids-standard/bids-specification#1928 downgrades to warning
{code: 'EMPTY_DATASET_NAME'},
]
}

const options = {

Check failure on line 13 in packages/openneuro-app/src/scripts/workers/schema.worker.ts

View workflow job for this annotation

GitHub Actions / eslint

'options' is assigned a value but never used. Allowed unused vars must match /^_/u
json: true,
/* Enable after https://github.com/bids-standard/bids-validator/pull/2176 is released */
// blacklistModalities: ["micr"],
}

Check warning on line 18 in packages/openneuro-app/src/scripts/workers/schema.worker.ts

View check run for this annotation

Codecov / codecov/patch

packages/openneuro-app/src/scripts/workers/schema.worker.ts#L5-L18

Added lines #L5 - L18 were not covered by tests
export async function runValidator(
files,
options,
Expand All @@ -14,7 +28,7 @@
} as BIDSValidatorIssues
try {
const tree = await fileListToTree(files)
const result = await validate(tree, { json: true })
const result = await validate(tree, options, config)

Check warning on line 31 in packages/openneuro-app/src/scripts/workers/schema.worker.ts

View check run for this annotation

Codecov / codecov/patch

packages/openneuro-app/src/scripts/workers/schema.worker.ts#L31

Added line #L31 was not covered by tests
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
const issues = Array.from(result.issues, ([key, value]) => value)
output.issues.warnings = issues.filter(
Expand Down
Loading