Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup and change of bids/validator class names back #221

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bids/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BidsJsonFile, BidsSidecar } from './types/json'
import { BidsEventFile, BidsTabularFile, BidsTsvFile } from './types/tsv'
import BidsDataset from './types/dataset'
import { BidsHedIssue, BidsIssue } from './types/issues'
import SidecarValidator from './validator/sidecarValidator'
import TsvValidator from './validator/tsvValidator'
import BidsHedSidecarValidator from './validator/sidecarValidator'
import BidsHedTsvValidator from './validator/tsvValidator'

export {
BidsDataset,
Expand All @@ -16,8 +16,8 @@ export {
BidsSidecar,
BidsIssue,
BidsHedIssue,
SidecarValidator,
TsvValidator,
BidsHedSidecarValidator,
BidsHedTsvValidator,
buildBidsSchemas,
validateBidsDataset,
}
Expand All @@ -31,8 +31,8 @@ export default {
BidsSidecar,
BidsIssue,
BidsHedIssue,
BidsHedSidecarValidator: SidecarValidator,
BidsHedTsvValidator: TsvValidator,
BidsHedSidecarValidator: BidsHedSidecarValidator,
BidsHedTsvValidator: BidsHedTsvValidator,
buildBidsSchemas,
validateBidsDataset,
}
4 changes: 2 additions & 2 deletions bids/types/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sidecarValueHasHed } from '../utils'
import { parseHedString } from '../../parser/parser'
import ParsedHedString from '../../parser/parsedHedString'
import { BidsFile } from './basic'
import SidecarValidator from '../validator/sidecarValidator'
import BidsHedSidecarValidator from '../validator/sidecarValidator'
import { IssueError } from '../../common/issues/issues'

const ILLEGAL_SIDECAR_KEYS = new Set(['hed', 'n/a'])
Expand All @@ -20,7 +20,7 @@ export class BidsJsonFile extends BidsFile {
jsonData

constructor(name, jsonData, file) {
super(name, file, SidecarValidator)
super(name, file, BidsHedSidecarValidator)
this.jsonData = jsonData
}
}
Expand Down
4 changes: 2 additions & 2 deletions bids/types/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BidsFile } from './basic'
import { convertParsedTSVData, parseTSV } from '../tsvParser'
import { BidsSidecar } from './json'
import ParsedHedString from '../../parser/parsedHedString'
import TsvValidator from '../validator/tsvValidator'
import BidsHedTsvValidator from '../validator/tsvValidator'
import { IssueError } from '../../common/issues/issues'

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export class BidsTsvFile extends BidsFile {
* @param {object} mergedDictionary The merged sidecar data.
*/
constructor(name, tsvData, file, potentialSidecars = [], mergedDictionary = {}) {
super(name, file, TsvValidator)
super(name, file, BidsHedTsvValidator)

if (typeof tsvData === 'string') {
this.parsedTsv = parseTSV(tsvData)
Expand Down
4 changes: 2 additions & 2 deletions bids/validator/sidecarValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { generateIssue, IssueError } from '../../common/issues/issues'
/**
* Validator for HED data in BIDS JSON sidecars.
*/
export class SidecarValidator {
export class BidsHedSidecarValidator {
/**
* The BIDS sidecar being validated.
* @type {BidsSidecar}
Expand Down Expand Up @@ -143,4 +143,4 @@ export class SidecarValidator {
}
}

export default SidecarValidator
export default BidsHedSidecarValidator
11 changes: 7 additions & 4 deletions bids/validator/tsvValidator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SidecarValidator from './sidecarValidator'
import BidsHedSidecarValidator from './sidecarValidator'
import { BidsHedIssue, BidsIssue } from '../types/issues'
import { BidsTsvEvent, BidsTsvRow } from '../types/tsv'
import { parseHedString } from '../../parser/parser'
Expand All @@ -12,7 +12,7 @@ import { validateHedString } from '../../validator/event/init'
/**
* Validator for HED data in BIDS TSV files.
*/
export class TsvValidator {
export class BidsHedTsvValidator {
/**
* The BIDS TSV file being validated.
* @type {BidsTsvFile}
Expand Down Expand Up @@ -55,7 +55,10 @@ export class TsvValidator {
if (BidsIssue.anyAreErrors(parsingIssues)) {
return this.issues
}
const curlyBraceIssues = new SidecarValidator(this.tsvFile.mergedSidecar, this.hedSchemas).validateCurlyBraces()
const curlyBraceIssues = new BidsHedSidecarValidator(
this.tsvFile.mergedSidecar,
this.hedSchemas,
).validateCurlyBraces()
const hedColumnIssues = this._validateHedColumn()
this.issues.push(...curlyBraceIssues, ...hedColumnIssues)
if (BidsIssue.anyAreErrors(this.issues)) {
Expand Down Expand Up @@ -383,4 +386,4 @@ export class BidsHedTsvParser {
}
}

export default TsvValidator
export default BidsHedTsvValidator
Loading
Loading