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(legacy): Support local BIDS-URIs for IntendedFor fields #2069

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
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
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 @@
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 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