bids-standard / bids-validator

Validator for the Brain Imaging Data Structure
https://bids-standard.github.io/bids-validator/
MIT License
185 stars 111 forks source link

HED module incorrectly reports HED_VERSION_NOT_DEFINED warning on HED tests #2170

Open happy5214 opened 4 days ago

happy5214 commented 4 days ago

The tests have improperly nested HED data in three sidecars (the HED level is the third level, where it should be the second level). This is causing https://github.com/hed-standard/hed-javascript/blob/916236a58b9912cb4fefc0e79aa9c28d0f35cedb/bids/types/json.js#L107 to (correctly) throw an IssueError for what amounts to a SIDECAR_INVALID HED error. However, the try block starting at https://github.com/bids-standard/bids-validator/blob/5646d9dee39eb9228881ec7e57887021cf3072b0/bids-validator/validators/hed.js#L34 incorrectly assumes all caught errors are missing schema errors, leading to improper issue reporting.

The tests need to be fixed to correct the level of HED in the three bad test sidecars, and hed.js needs to be re-coded to find another way to deal with a null return from the validation function.

Originally posted by @happy5214 in https://github.com/bids-standard/bids-validator/issues/2167#issuecomment-2432545093

happy5214 commented 4 days ago

Please assign this to me. I plan to work on this in the next day or two.