File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,21 @@ import type { GenericSchema } from '../../types/schema.ts'
22import type { BIDSFile , FileTree } from '../../types/filetree.ts'
33import type { BIDSContextDataset } from '../../schema/context.ts'
44
5- function * walkFileTree ( fileTree ?: FileTree ) : Generator < BIDSFile > {
5+ function * walkFileTree ( fileTree ?: FileTree , dsContext : BIDSContextDataset ) : Generator < BIDSFile > {
6+
67 if ( ! fileTree ) {
78 return
89 }
10+
911 for ( const file of fileTree . files ) {
1012 if ( ! file . ignored ) {
1113 yield file
1214 }
1315 }
16+
1417 for ( const dir of fileTree . directories ) {
15- if ( ! dir . ignored ) {
16- yield * walkFileTree ( dir )
18+ if ( ! dir . ignored && ! dsContext . isPseudoFile ( dir ) && ! dsContext . isOpaqueDirectory ( dir ) ) {
19+ yield * walkFileTree ( dir , dsContext )
1720 }
1821 }
1922}
@@ -35,9 +38,9 @@ export async function sidecarWithoutDatafile(
3538 schema : GenericSchema ,
3639 dsContext : BIDSContextDataset ,
3740) {
38- const unusedSidecars = [ ...walkFileTree ( dsContext . tree ) ] . filter (
41+ const unusedSidecars = [ ...walkFileTree ( dsContext . tree , dsContext ) ] . filter (
3942 ( file ) => ( ! file . viewed && file . name . endsWith ( '.json' ) &&
40- ! standalone_json . includes ( file . name ) ) ,
43+ ! standalone_json . includes ( file . name ) ) ,
4144 )
4245 unusedSidecars . forEach ( ( sidecar ) => {
4346 dsContext . issues . add ( { code : 'SIDECAR_WITHOUT_DATAFILE' , location : sidecar . path } )
You can’t perform that action at this time.
0 commit comments