Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
david-nishi committed Oct 23, 2018
1 parent 47d551c commit 2c23a3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
15 changes: 9 additions & 6 deletions tests/nii.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ describe('NIFTI', function() {
})
validate.NIFTI(null, file, jsonContentsDict, {}, [], [], function(issues) {
assert(
issues.some(issue => (
issue.reason === 'Invalid filetype: IntendedFor should point to the .nii[.gz] files.' &&
issue.evidence === 'func/sub-15_task-mixedeventrelatedprobe_run-05_bold.json'
)),
issues.some(
issue =>
issue.reason ===
'Invalid filetype: IntendedFor should point to the .nii[.gz] files.' &&
issue.evidence ===
'func/sub-15_task-mixedeventrelatedprobe_run-05_bold.json',
),
)
})
})

it('should generate warning if files listed in IntendedFor of fieldmap json do not exist', function() {
var file = {
name: 'sub-09_ses-test_run-01_fieldmap.nii.gz',
Expand Down Expand Up @@ -187,7 +190,7 @@ describe('NIFTI', function() {
})
validate.NIFTI(null, file, jsonContentsDict, {}, [], [], function(issues) {
assert(
(issues.length === 3 && issues[0].code == 17 && issues[1].code == 37),
issues.length === 3 && issues[0].code == 17 && issues[1].code == 37,
)
})
})
Expand Down
13 changes: 7 additions & 6 deletions validators/nifti/nii.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ module.exports = function NIFTI(
typeof mergedDictionary['IntendedFor'] == 'string'
? [mergedDictionary['IntendedFor']]
: mergedDictionary['IntendedFor']

for (let key = 0; key < intendedFor.length; key++) {
const intendedForFile = intendedFor[key]
checkIfIntendedExists(intendedForFile, fileList, issues, file)
Expand Down Expand Up @@ -486,9 +486,11 @@ function checkIfIntendedExists(intendedForFile, fileList, issues, file) {
let onTheList = false

for (let key2 in fileList) {
const filePath = fileList[key2].relativePath
if (filePath === intendedForFileFull) {
onTheList = true
if (key2) {
const filePath = fileList[key2].relativePath
if (filePath === intendedForFileFull) {
onTheList = true
}
}
}
if (!onTheList) {
Expand Down Expand Up @@ -519,8 +521,7 @@ function checkIfValidFiletype(intendedForFile, issues, file) {
new Issue({
file: file,
code: 37,
reason:
`Invalid filetype: IntendedFor should point to the .nii[.gz] files.`,
reason: `Invalid filetype: IntendedFor should point to the .nii[.gz] files.`,
evidence: intendedForFile,
}),
)
Expand Down

0 comments on commit 2c23a3d

Please sign in to comment.