Skip to content

Commit

Permalink
Revert "Completed implementation of HED validator"
Browse files Browse the repository at this point in the history
  • Loading branch information
VisLab authored Dec 23, 2024
1 parent afe0e3e commit d430b66
Show file tree
Hide file tree
Showing 74 changed files with 15,096 additions and 6,480 deletions.
2 changes: 1 addition & 1 deletion bids/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import castArray from 'lodash/castArray'
import semver from 'semver'

import { buildSchemas } from '../schema/init'
import { IssueError } from '../common/issues/issues'
import { generateIssue, IssueError } from '../common/issues/issues'
import { SchemaSpec, SchemasSpec } from '../schema/specs'

const alphabeticRegExp = new RegExp('^[a-zA-Z]+$')
Expand Down
21 changes: 4 additions & 17 deletions bids/types/basic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BidsHedIssue } from './issues'
import { generateIssue } from '../../common/issues/issues'

/**
* A BIDS file.
Expand Down Expand Up @@ -37,27 +36,15 @@ export class BidsFile {
return false
}

/**
* Validate this validator's tsv file
*
* @param {Schemas} schemas
* @returns {BidsIssue[]} Any issues found during validation of this TSV file.
*/
validate(schemas) {
validate(hedSchemas) {
if (!this.hasHedData()) {
return []
}
if (!schemas) {
BidsHedIssue.fromHedIssue(
generateIssue('genericError', {
message: 'BIDS file HED validation requires a HED schema, but the schema received was null.',
}),
{ path: this.file.file, relativePath: this.file.file },
)
} else if (hedSchemas === null) {
return null
}

try {
const validator = new this.validatorClass(this, schemas)
const validator = new this.validatorClass(this, hedSchemas)
return validator.validate()
} catch (internalError) {
return BidsHedIssue.fromHedIssues(internalError, this.file)
Expand Down
4 changes: 3 additions & 1 deletion bids/types/dataset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fallbackDatasetDescription } from './json'

export class BidsDataset {
/**
* The dataset's event file data.
Expand All @@ -20,7 +22,7 @@ export class BidsDataset {
*/
datasetRootDirectory

constructor(eventData, sidecarData, datasetDescription, datasetRootDirectory = null) {
constructor(eventData, sidecarData, datasetDescription = fallbackDatasetDescription, datasetRootDirectory = null) {
this.eventData = eventData
this.sidecarData = sidecarData
this.datasetDescription = datasetDescription
Expand Down
2 changes: 1 addition & 1 deletion bids/types/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class BidsIssue {
* Determine if any of the passed issues are errors.
*
* @param {BidsIssue[]} issues A list of issues.
* @returns {boolean} Whether any of the passed issues are errors (rather than warnings).
* @return {boolean} Whether any of the passed issues are errors (rather than warnings).
*/
static anyAreErrors(issues) {
return issues.some((issue) => issue.isError())
Expand Down
Loading

0 comments on commit d430b66

Please sign in to comment.