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 070a31d commit 525163b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 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 @@ -121,8 +122,12 @@ export async function validate(
// 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)
if (datatypes) {
for (const datatype of datatypes) {
blacklistedDatatypes.set(datatype, modality)
}
} else {
logger.warn(`Attempted to blacklist unknown modality: ${modality}`)

Check warning on line 130 in bids-validator/src/validators/bids.ts

View check run for this annotation

Codecov / codecov/patch

bids-validator/src/validators/bids.ts#L130

Added line #L130 was not covered by tests
}
}
}
Expand Down

0 comments on commit 525163b

Please sign in to comment.