-
Notifications
You must be signed in to change notification settings - Fork 26
fix: use .bids-validator-config.json by default if available. #329
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
Open
rwblair
wants to merge
9
commits into
main
Choose a base branch
from
fix/use_default_config_file
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
13d9c33
Have cli and web validator attempt to load '.bids-validator-config.js…
rwblair be5b560
add changelog file
rwblair 314c5cd
Merge branch 'main' of github.com:bids-standard/bids-validator into f…
rwblair 0c4797f
Update src/main.ts
rwblair 215c7b5
Update web/src/App.tsx
rwblair 5076341
Merge branch 'main' into fix/use_default_config_file
rwblair a245c3d
Merge branch 'fix/use_default_config_file' of github.com:bids-standar…
rwblair cdc611c
log error instead of crashing on invalid config file.
rwblair 53e9074
Remove unused variable, add period to config error message
rwblair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
changelog.d/20251218_163750_rosswilsonblair_use_default_config_file.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Added | ||
|
|
||
| - A bullet item for the Added category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Changed | ||
|
|
||
| - A bullet item for the Changed category. | ||
|
|
||
| --> | ||
| ### Fixed | ||
|
|
||
| - CLI and web validator now default to loading '.bids-validator-config.json'. Validator only attempts this if no other config file was passed in. | ||
|
|
||
| <!-- | ||
| ### Deprecated | ||
|
|
||
| - A bullet item for the Deprecated category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Removed | ||
|
|
||
| - A bullet item for the Removed category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Security | ||
|
|
||
| - A bullet item for the Security category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Infrastructure | ||
|
|
||
| - A bullet item for the Infrastructure category. | ||
|
|
||
| --> |
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
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
Oops, something went wrong.
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.
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.
What if we did what we do for
.bidsignoreand pull it out of thetree? We don't need a filesystem hit to check if it's there.We could also use our JSON loader and create an issue. Probably better not to crash...
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.
Using
loadJSONfor the default config and std functions for the cli specified config cause the error objects produced to be different.The crash from either error is uninformative as currently implemented. Injecting these caught errors as issues into the dataset issues feels wrong for two reasons. It isn't an issue with validity with respect to the specification and its likely to get lost the sea of errors/issues. Treating them as issues instead of console output is good for people who consume the json validation results. Should we be outputting logger messages in the json output object?
We could treat them as a separate class of issue that gets special treatment with their own section in validation results. For standard output these could be printed immediately before or after the summary output to highlight them since we are changing the behavior of the validation from what was likely intended by the user as opposed to reporting a normal validation issue. The failure to load a user specified schema would fall under this new class of issue. Currently we log some output saying that we are falling back to the default schema but this output is at the beginning of validation and is hard to notice, its something that I've been bit by before.
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.
cdc611c Wraps the both json loads in a try catch that calls logger.error, this is at least closer to the behavior of the web validator as is. I'm still open to making them issues.
Example output with config file specified:
For an empty implicit config 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.
Here's an implementation that doesn't use stat, has both types of config files produce errors of the same type, and catches the error: