Repository navigation
Report empty lines and wrong cell counts in tabular files - #978
Merged
Merged
Conversation
Port hed-typescript's line rules (specification 3.2.10). The header is always line 1, so an empty first line is one blank column name. One line break at the end is not a line; any other empty line is TABULAR_INVALID (emptyTsvLine), and a line whose cell count differs from line 1 is TABULAR_INVALID (tsvCellCount). Row problems are reported by line after header problems and before the sidecar is checked. They are checked only on files that carry HED, including a HED cell in the first non-empty line. Move the hed-tests pin to 0a07fe0; its 11 new TABULAR_INVALID cases pass. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Sidecar-construction errors still mask malformed-row diagnostics, violating the promised validation order and leaving the combined-error case without regression coverage.
1 open issue
What changed in this PR
This PR adds specification 3.2.10 line checks to the HED validator's tabular-file handling, aligning behavior with hed-typescript.
Changes:
- Treat line 1 as the header and preserve empty data lines, excluding one final line break.
- Report empty lines and mismatched cell counts in line order for files carrying HED.
- Add regression tests, public diagnostic fields, and changelog documentation.
| File | Description |
|---|---|
types/index.d.ts |
Declares the new row diagnostic fields. |
tests/otherTests/tsvParser.spec.js |
Tests line rules, diagnostic ordering, and HED detection. |
src/issues/data.js |
Adds messages for empty lines and incorrect cell counts. |
src/bids/validator/tsvValidator.js |
Reports row problems before sidecar validation. |
src/bids/types/tsv.js |
Stores row diagnostics and detects HED after empty initial lines. |
src/bids/tsvParser.js |
Preserves file lines and identifies row structure problems. |
CHANGELOG.md |
Documents the updated tabular validation behavior. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Port hed-typescript's line rules (specification 3.2.10). The header is always line 1, so an empty first line is one blank column name. One line break at the end is not a line; any other empty line is TABULAR_INVALID (emptyTsvLine), and a line whose cell count differs from line 1 is TABULAR_INVALID (tsvCellCount). Row problems are reported by line after header problems and before the sidecar is checked. They are checked only on files that carry HED, including a HED cell in the first non-empty line.
Move the hed-tests pin to 0a07fe0; its 11 new TABULAR_INVALID cases pass.