@@ -4,7 +4,7 @@ import checkAcqTimeFormat from './checkAcqTimeFormat'
44import checkAge89 from './checkAge89'
55import checkStatusCol from './checkStatusCol'
66import parseTSV from './tsvParser'
7- var path = require ( 'path' ) ;
7+ var path = require ( 'path' )
88
99/**
1010 * Format TSV headers for evidence string
@@ -20,7 +20,6 @@ const headersEvidence = headers => `Column headers: ${headers.join(', ')}`
2020 */
2121const filenameEvidence = filename => `Filename: ${ filename } `
2222
23-
2423/**
2524 * TSV
2625 *
@@ -135,7 +134,7 @@ const TSV = (file, contents, fileList, callback) => {
135134 } ) ,
136135 )
137136 }
138- if ( headers . length == 1 || headers [ 1 ] . trim ( ) !== 'duration' ) {
137+ if ( headers . length < 2 || headers [ 1 ] . trim ( ) !== 'duration' ) {
139138 issues . push (
140139 new Issue ( {
141140 file : file ,
@@ -314,15 +313,15 @@ const TSV = (file, contents, fileList, callback) => {
314313
315314 // get the subject and session for this scans.tsv file
316315 const subject = file . name . split ( '_' ) . slice ( 0 , 1 )
317-
316+
318317 // get the relative subject path
319318 const subRelativePath = '/' + subject
320319
321320 // get list of file paths for this subject and session
322321 const pathList = [ ]
323322 for ( let file of Object . values ( fileList ) ) {
324323 const fPath = file . relativePath
325-
324+
326325 // XXX: needs to be improved, since this currently allows arbitrary directory nesting
327326 // dataset file needs to be within the subject
328327 // and session directory
@@ -336,7 +335,7 @@ const TSV = (file, contents, fileList, callback) => {
336335 pathList . push ( fPath )
337336 }
338337 }
339- }
338+ }
340339
341340 // check _scans.tsv for column filename
342341 if ( ! ( headers . indexOf ( 'filename' ) > - 1 ) ) {
@@ -348,23 +347,23 @@ const TSV = (file, contents, fileList, callback) => {
348347 code : 68 ,
349348 } ) ,
350349 )
351- } else {
350+ } else {
352351 // check scans filenames match pathList
353352 const filenameColumn = headers . indexOf ( 'filename' )
354353 for ( let l = 1 ; l < rows . length ; l ++ ) {
355354 const row = rows [ l ]
356355 const scanRelativePath = row [ filenameColumn ]
357356 const scanFullPath = scanDirPath + '/' + scanRelativePath
358-
357+
359358 // check if scan matches full dataset path list
360- if ( ! ( pathList . includes ( scanFullPath ) ) ) {
359+ if ( ! pathList . includes ( scanFullPath ) ) {
361360 issues . push (
362361 new Issue ( {
363362 line : l ,
364363 file : file ,
365364 code : 129 ,
366365 evidence : filenameEvidence ( scanFullPath ) ,
367- } )
366+ } ) ,
368367 )
369368 }
370369 }
0 commit comments