Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_validate(selectedFiles) {
const dirName = selectedFiles.list[0].webkitRelativePath.split('/')[0]
const defaultConfig = `${dirName}/.bids-validator-config.json`
this.setState({
status: 'validating',
showIssues: true,
activeKey: 3,
dirName,
})
return validate.BIDS(
selectedFiles.list,
{
verbose: true,
...this.state.options,
config: defaultConfig,
},
(issues, summary) => {
if (issues === 'Invalid') {
return this.setState({
errors: 'Invalid',
summary,
status: 'validated',
})
} else {
return this.setState({
errors: issues.errors ? issues.errors : [],
return new Promise((resolve, reject) => {
validate.BIDS(dir, options, ({ errors, warnings }, summary) => {
if (errors.length + warnings.length === 0) {
resolve({ summary })
} else {
reject({ errors, warnings })
}
})
})
}
new Promise(resolve => {
validate.BIDS(files, options, (issues, summary) =>
resolve({ issues, summary }),
)
})
componentWillMount() {
const options = {}
validate.BIDS(this.props.files, options, this.done)
}
scitran.downloadSymlinkDataset(datasetId, (err, hash) => {
if (err) {
return res.status(500).send({ error: generic_failure })
}
try {
validate.BIDS(
config.location + '/persistent/datasets/' + hash,
{},
(validation, summary) => {
scitran.updateProject(
datasetId,
{
metadata: { validation, summary },
},
() => {
scitran.removeTag('projects', datasetId, 'validating', () => {
if (validation.errors && validation.errors.length > 0) {
scitran.addTag('projects', datasetId, 'invalid', () => {
res.send({ validation, summary })
})
} else {
scitran.removeTag('projects', datasetId, 'invalid', () => {