Skip to content

Commit

Permalink
feat(legacy): Support BIDS-URIs for IntendedFor fields
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Aug 7, 2024
1 parent 1453bc1 commit a6a19f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
20 changes: 10 additions & 10 deletions bids-validator/validators/microscopy/checkJSONAndField.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ const checkIfIntendedExists = (intendedFor, fileList, file) => {
for (let key = 0; key < intendedFor.length; key++) {
const intendedForFile = intendedFor[key]
const intendedForFileFull =
'/' + file.relativePath.split('/')[1] + '/' + intendedForFile
let onTheList = false
for (let key2 in fileList) {
if (key2) {
const filePath = fileList[key2].relativePath
if (filePath === intendedForFileFull) {
onTheList = true
}
}
}
'/' +
(intendedForFile.startsWith('bids::')
? intendedForFile.split('::')[1]

Check warning on line 105 in bids-validator/validators/microscopy/checkJSONAndField.js

View check run for this annotation

Codecov / codecov/patch

bids-validator/validators/microscopy/checkJSONAndField.js#L105

Added line #L105 was not covered by tests
: file.relativePath.split('/')[1] + '/' + intendedForFile)
const onTheList = Object.values(fileList).some(
(f) =>
f.relativePath === intendedForFileFull ||
// Consider .ome.zarr/ files
f.relativePath.startsWith(`${intendedForFileFull}/`),
)
if (!onTheList) {
issues.push(
new Issue({
Expand Down
18 changes: 7 additions & 11 deletions bids-validator/validators/nifti/nii.js
Original file line number Diff line number Diff line change
Expand Up @@ -1396,17 +1396,13 @@ function sliceTimingGreaterThanRepetitionTime(array, repetitionTime) {

function checkIfIntendedExists(intendedForFile, fileList, issues, file) {
const intendedForFileFull =
'/' + file.relativePath.split('/')[1] + '/' + intendedForFile
let onTheList = false

for (let key2 in fileList) {
if (key2) {
const filePath = fileList[key2].relativePath
if (filePath === intendedForFileFull) {
onTheList = true
}
}
}
'/' +
(intendedForFile.startsWith('bids::')
? intendedForFile.split('::')[1]

Check warning on line 1401 in bids-validator/validators/nifti/nii.js

View check run for this annotation

Codecov / codecov/patch

bids-validator/validators/nifti/nii.js#L1401

Added line #L1401 was not covered by tests
: file.relativePath.split('/')[1] + '/' + intendedForFile)
const onTheList = Object.values(fileList).some(
(f) => f.relativePath === intendedForFileFull,
)
if (!onTheList) {
issues.push(
new Issue({
Expand Down

0 comments on commit a6a19f8

Please sign in to comment.