Skip to content

Commit 973bebd

Browse files
authored
Merge pull request #379 from chrisfilo/enh/elevate_notbids_to_error
Elevate "not BIDS" warning to an error
2 parents dd416e7 + 3b1dc68 commit 973bebd

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

tests/bids.spec.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ function getDirectories(srcpath) {
1818

1919
var missing_session_files = ['7t_trt', 'ds006', 'ds007', 'ds008', 'ds051', 'ds052', 'ds105', 'ds108', 'ds109', 'ds113b'];
2020

21+
function assertErrorCode(errors, expected_error_code) {
22+
var matchingErrors = errors.filter(function (error) {
23+
return error.code === expected_error_code;
24+
});
25+
assert(matchingErrors.length >= 0);
26+
}
27+
2128
var suite = describe('BIDS example datasets ', function() {
2229
this.timeout(100000);
2330

@@ -102,8 +109,7 @@ var suite = describe('BIDS example datasets ', function() {
102109
it('validates dataset with illegal characters in task name', function(isdone) {
103110
var options = {ignoreNiftiHeaders: false};
104111
validate.BIDS("tests/data/valid_filenames", options, function (issues) {
105-
var errors = issues.errors;
106-
assert(errors[0].code === '58');
112+
assertErrorCode(issues.errors, '58');
107113
isdone();
108114
});
109115
});
@@ -112,8 +118,7 @@ var suite = describe('BIDS example datasets ', function() {
112118
it('validates dataset with illegal characters in sub name', function(isdone) {
113119
var options = {ignoreNiftiHeaders: false};
114120
validate.BIDS("tests/data/valid_filenames", options, function (issues) {
115-
var errors = issues.errors;
116-
assert(errors[2].code ==='64');
121+
assertErrorCode(issues.errors, '64');
117122
isdone();
118123
});
119124
});
@@ -129,11 +134,9 @@ var suite = describe('BIDS example datasets ', function() {
129134
delete Array.prototype.broken;
130135
});
131136
it('validates dataset with illegal characters in task name', function (isdone) {
132-
133137
var options = {ignoreNiftiHeaders: false};
134138
validate.BIDS("tests/data/valid_filenames", options, function (issues) {
135-
var errors = issues.errors;
136-
assert(errors[0].code === '58');
139+
assertErrorCode(issues.errors, '58');
137140
isdone();
138141
});
139142
});
@@ -142,9 +145,7 @@ var suite = describe('BIDS example datasets ', function() {
142145
it('checks for subjects with no valid data', function (isdone) {
143146
var options = {ignoreNiftiHeaders: true};
144147
validate.BIDS("tests/data/no_valid_data", options, function (issues) {
145-
var errors = issues.errors;
146-
assert(errors.length === 1);
147-
assert(errors[0].code === '67');
148+
assertErrorCode(issues.errors, '67');
148149
isdone();
149150
});
150151
});

utils/issues/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module.exports = {
99
1: {
1010
key: 'NOT_INCLUDED',
11-
severity: 'warning',
11+
severity: 'error',
1212
reason: 'Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you can ignore this warning. Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder.'
1313
},
1414
2: {

0 commit comments

Comments
 (0)