Skip to content

Commit ac133ef

Browse files
committed
rf: Await context load in walkFileTree, check ignore before loading
1 parent 4fb42df commit ac133ef

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/schema/walk.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ async function* _walkFileTree(
4747
dsContext: BIDSContextDataset,
4848
): AsyncIterable<BIDSContext | CleanupFunction> {
4949
for (const file of fileTree.files) {
50+
if (file.ignored) {
51+
continue
52+
}
5053
yield new BIDSContext(file, dsContext)
5154
}
5255
for (const dir of fileTree.directories) {
56+
if (dir.ignored) {
57+
continue
58+
}
5359
const pseudo = dsContext.isPseudoFile(dir)
5460
const opaque = pseudo || dsContext.isOpaqueDirectory(dir)
5561
const context = new BIDSContext(pseudoFile(dir, opaque), dsContext)
@@ -70,12 +76,8 @@ export async function* walkFileTree(
7076
dsContext: BIDSContextDataset,
7177
bufferSize: number = 1,
7278
): AsyncIterable<BIDSContext> {
73-
for await (
74-
await using context of queuedAsyncIterator(
75-
_walkFileTree(dsContext.tree, dsContext),
76-
bufferSize,
77-
)
78-
) {
79+
for await (const context of queuedAsyncIterator(_walkFileTree(dsContext.tree, dsContext), bufferSize)) {
80+
await context.loaded
7981
yield context
8082
}
8183
}

src/validators/bids.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,12 @@ export async function validate(
109109
})
110110

111111
for await (const context of walkFileTree(dsContext, 20)) {
112-
// TODO - Skip ignored files for now (some tests may reference ignored files)
113-
if (context.file.ignored) {
114-
continue
115-
}
116112
if (
117113
dsContext.dataset_description.DatasetType == 'raw' &&
118114
context.file.path.includes('derivatives')
119115
) {
120116
continue
121117
}
122-
await context.loaded
123118
// Run majority of checks
124119
for (const check of perContextChecks) {
125120
await check(schema as unknown as GenericSchema, context)

0 commit comments

Comments
 (0)