Skip to content

Commit

Permalink
Log a warning if an unknown modality is blacklisted
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 25, 2024
1 parent a99cdc4 commit 75a44e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bids-validator/src/validators/bids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { type BIDSContext, BIDSContextDataset } from '../schema/context.ts'
import type { parseOptions } from '../setup/options.ts'
import { hedValidate } from './hed.ts'
import { citationValidate } from './citation.ts'
import { logger } from '../utils/logger.ts'

/**
* Ordering of checks to apply
Expand Down Expand Up @@ -119,10 +120,14 @@ export async function validate(
const blacklistedDatatypes = new Map<string, string>()
if (options.blacklistModalities) {
// Map blacklisted datatypes back to the modality that generated them
for (const modality of options.blacklistModalities) {
const datatypes = modalitiesRule[modality.toLowerCase()]?.datatypes as string[]
for (const datatype of datatypes) {
blacklistedDatatypes.set(datatype, modality)
for (const modalityName of options.blacklistModalities) {
const modality = modalitiesRule[modalityName.toLowerCase()]
if (modality?.datatypes) {
for (const datatype of datatypes) {
blacklistedDatatypes.set(datatype, modality)
}
} else {
logger.warn(`Attempted to blacklist unknown modality: ${modalityName}`)
}
}
}
Expand Down

0 comments on commit 75a44e8

Please sign in to comment.