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

Pass value of ignore test to creation of filetree object. #2152

Merged
merged 9 commits into from
Oct 9, 2024
2 changes: 1 addition & 1 deletion bids-validator/src/files/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function _readFileTree(
): Promise<FileTree> {
await requestReadPermission()
const name = basename(relativePath)
const tree = new FileTree(relativePath, name, parent)
const tree = new FileTree(relativePath, name, parent, ignore.test(join(rootPath, relativePath)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will be sufficient, since we could recurse into a directory before reading .bidsignore from the first directory. I think we might instead need to make FileTree do an active lookup into an ignore object like BIDSFileDeno does above.


for await (const dirEntry of Deno.readDir(join(rootPath, relativePath))) {
if (dirEntry.isFile || dirEntry.isSymlink) {
Expand Down
3 changes: 3 additions & 0 deletions bids-validator/src/validators/bids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export async function validate(
const bidsDerivatives: FileTree[] = []
const nonstdDerivatives: FileTree[] = []
fileTree.directories = fileTree.directories.filter((dir) => {
if (['sourcedata', 'code'].includes(dir.name)) {
return false
}
if (dir.name !== 'derivatives') {
return true
}
Expand Down
Loading