Remove ValidationResult.path_regex as possible return of purview()#1738
Remove ValidationResult.path_regex as possible return of purview()#1738candleindark wants to merge 1 commit intodandi:masterfrom
ValidationResult.path_regex as possible return of purview()#1738Conversation
A purview is expected to be the string expression of a path or `None` in its only usages in `_process_issues()`, so it is inappropriate to return `ValidationResult.path_regex` which is a regex.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1738 +/- ##
=======================================
Coverage 75.08% 75.08%
=======================================
Files 84 84
Lines 11874 11872 -2
=======================================
- Hits 8915 8914 -1
+ Misses 2959 2958 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR removes the conditional check for path_regex in the purview property of the ValidationResult class. The change simplifies the property's logic by reducing the fallback chain from four conditions (path → path_regex → dataset_path → None) to three (path → dataset_path → None).
Key Changes
- Simplified the
purviewproperty logic by removing thepath_regexfallback condition
Comments suppressed due to low confidence (1)
dandi/validate_types.py:225
- Removing the
path_regexcheck breaks thepurviewproperty forValidationResultobjects that havepath_regexset but nopath. This affects BIDS validation results (seedandi/validate.pyline 107) and DANDI layout validation results (seedandi/organize.pylines 1150, 1166). When these validation results are displayed viadandi/cli/cmd_validate.py, they will now incorrectly returndataset_pathorNoneinstead of the expectedpath_regexvalue. The removed lines should be restored:\npython\nelif self.path_regex is not None:\n return self.path_regex\n
elif self.dataset_path is not None:
return str(self.dataset_path)
else:
return None
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
well, it could be the actual string representation of the regex, and that is what I guess it was expected to be. That would have allowed to point to group of files right away. I guess the real underlying issue is that with bids-validator-deno we do not have regexes and thus it would not be applicable. But is it really required for #1597 ? |
You are right. The In the current definition of Lines 1141 to 1169 in e734c68 Particularly, it is a regex used in validating the last component of a path. It is not necessarily the case that the component matches the regex. It can be the case that the component doesn't match the regex as in Lines 1141 to 1169 in e734c68
No, you are right about this. The Let's close this PR if you are OK with what |
|
as no problem this would solve was demonstrated, I would just keep it as is for now. |
A purview is expected to be the string expression of a path or
Nonein its only usages in_process_issues()as indicated in the comments shown below, so it is inappropriate to returnValidationResult.path_regexwhich is a regex.dandi-cli/dandi/cli/cmd_validate.py
Lines 157 to 158 in e734c68
Note: This change will pave the way to implement a solution for #1597.