- Notifications
You must be signed in to change notification settings - Fork 33
Add HINT validation result suggesting .bidsignore for dandiset.yaml #1741
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## master #1741 +/- ## ========================================== + Coverage 75.02% 75.05% +0.02% ========================================== Files 84 84 Lines 11889 11900 +11 ========================================== + Hits 8920 8931 +11 Misses 2969 2969
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:
|
When BIDS validator encounters dandiset.yaml (not part of BIDS spec), now: - Keeps the existing ERROR about the file not matching BIDS patterns - Adds a new HINT level validation result suggesting to create/update .bidsignore Includes test to verify both ERROR and HINT are generated Co-authored-by: yarikoptic <39889+yarikoptic@users.noreply.github.com>
5d5dd81 to 957da04 Compare | @yarikoptic I don't get the point of this or #1740. If we don't want the problem with |
| We don't want to "cheat" bids validator, so if people run it directly they get the same result. AI we want to instruct for to mitigate that error consistently |
| Tested against dandiset 001442 (chosen because it is a smallish BIDS dataset, though lots of validation noise). The PR works as described - the IMO this is fine, the HINT probably will be easier to understand for unfamiliar users, even though the duplication and extra noise are somewhat undesirable. trimmed raw output: master branchtrimmed output: PR branchDiff between master and branch5a6,7 > [DANDI.BIDSIGNORE_DANDISET_YAML] /home/austin/devel/dandi-cli/001442 — Consider creating or updating a `.bidsignore` file in the root of your BIDS dataset to ignore `dandiset.yaml`. Add the following line to `.bidsignore`: > dandiset.yaml |
candleindark left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed some changes.
Additionally, if we want this custom validation hint to show up in the dandi upload command as well, we need to move this logic to an earlier point the in the calling process. The current setup only affect dandi validate not dandi upload where the issue was originally reported at #1734 (comment).
| if is_dandiset_yaml_error: | ||
| r.message = ( | ||
| f"The dandiset metadata file, `{dandiset_metadata_file}`, " | ||
| f"is not a part of BIDS specification. Please include a " | ||
| f"`.bidsignore` file with specification to ignore the " | ||
| f"metadata file in your dataset. For more details, see " | ||
| f"https://github.com/bids-standard/bids-specification/" | ||
| f"issues/131#issuecomment-461060166." | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now have a separate hind for to suggest for modifying .bidsignore, and we want to preserve the original error from BIDS deno validator as much as possible, we can remove this modification of the original error message.
| hint = ValidationResult( | ||
| id="DANDI.BIDSIGNORE_DANDISET_YAML", | ||
| origin=ORIGIN_VALIDATION_DANDI_LAYOUT, | ||
| severity=Severity.HINT, | ||
| scope=Scope.DATASET, | ||
| path=r.dataset_path, | ||
| dataset_path=r.dataset_path, | ||
| dandiset_path=dandiset_path, | ||
| message=( | ||
| f"Consider creating or updating a `.bidsignore` file " | ||
| f"in the root of your BIDS dataset to ignore " | ||
| f"`{dandiset_metadata_file}`. " | ||
| f"Add the following line to `.bidsignore`:\n" | ||
| f"{dandiset_metadata_file}" | ||
| ), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| hint = ValidationResult( | |
| id="DANDI.BIDSIGNORE_DANDISET_YAML", | |
| origin=ORIGIN_VALIDATION_DANDI_LAYOUT, | |
| severity=Severity.HINT, | |
| scope=Scope.DATASET, | |
| path=r.dataset_path, | |
| dataset_path=r.dataset_path, | |
| dandiset_path=dandiset_path, | |
| message=( | |
| f"Consider creating or updating a `.bidsignore` file " | |
| f"in the root of your BIDS dataset to ignore " | |
| f"`{dandiset_metadata_file}`. " | |
| f"Add the following line to `.bidsignore`:\n" | |
| f"{dandiset_metadata_file}" | |
| ), | |
| ) | |
| hint = ValidationResult( | |
| id="DANDI.BIDSIGNORE_DANDISET_YAML", | |
| origin=ORIGIN_VALIDATION_DANDI_LAYOUT, | |
| scope=Scope.DATASET, | |
| origin_result=r, | |
| severity=Severity.HINT, | |
| dandiset_path=r.dandiset_path, | |
| dataset_path=r.dataset_path, | |
| path=r.path, | |
| message=( | |
| f"Consider creating or updating a `.bidsignore` file " | |
| f"in the root of your BIDS dataset to ignore " | |
| f"`{dandiset_metadata_file}`. " | |
| f"Add the following line to `.bidsignore`:\n" | |
| f"{dandiset_metadata_file}" | |
| ), | |
| ) |
When BIDS validator encounters
dandiset.yaml(not part of BIDS spec), users now receive both the ERROR and a HINT suggesting to add the file to.bidsignore.Changes
dandi/validate.py
DANDI.BIDSIGNORE_DANDISET_YAML, severity:Severity.HINT, scope:DATASET.bidsignoredandi/tests/test_validate.py
test_validate_bids()to verify both ERROR and HINT are generatedExample Output
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.