bids-validator
bids-validator copied to clipboard
CLI: allow --config option to take error codes (e.g., NIFTI_UNIT) on top of numeric codes (e.g., 99)
Currently there are a number of issues with the --config flag in the CLI:
-
[x] it expects two configurations at least! The hack if I have one configuration is to pass it twice, but it seems like a very weird way of doing things --> EDIT @sappelhoff: now tracked by #1168
-
[ ] it does not accept the error codes, only the numerical codes. For example I'd like to be able to pass:
$ bids-validator --config.error=NIFTI_UNIT path/to/bids/dir
- [x] also I get weird errors when I try to use a json file for the --config: --> EDIT @sappelhoff: now tracked by #1165
(node:11782) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of undefined
(node:11782) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
- [x] I think the root cause is that this is not very well tested, so it's not caught when you make new commits, for example here --> EDIT @sappelhoff: now tracked by #1169
Not only that, but when trying to use just the --config option, there is an error with the function:
When using:
$ bids-validator -c config.json path/to/bids/dir
[email protected]
/usr/local/lib/node_modules/bids-validator/utils/options.js:44
.readFile({ path: config })
^
TypeError: files.readFile is not a function
at Object.loadConfig (/usr/local/lib/node_modules/bids-validator/utils/options.js:44:10)
at Object.parseConfig (/usr/local/lib/node_modules/bids-validator/utils/options.js:60:10)
at Object.parse (/usr/local/lib/node_modules/bids-validator/utils/options.js:23:12)
at Object.start [as BIDS] (/usr/local/lib/node_modules/bids-validator/validators/bids/start.js:23:17)
at module.exports (/usr/local/lib/node_modules/bids-validator/cli.js:39:16)
at Object.<anonymous> (/usr/local/lib/node_modules/bids-validator/bin/bids-validator:55:18)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)