-
Notifications
You must be signed in to change notification settings - Fork 308
FIX: non-existing path or JSON syntax error for --bids-filter-file should raise on error.
#2331
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
FIX: non-existing path or JSON syntax error for --bids-filter-file should raise on error.
#2331
Conversation
fc6c613 to
962f0b2
Compare
mgxd
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.
LGTM - this should probably be backported to the LTS as well. It should be a relatively clean process if you change the target branch to maint/20.2.x
fmriprep/cli/parser.py
Outdated
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.
maybe a FileNotFoundError would be more helpful here?
| else: | |
| raise parser.error(f"Path does not exist: <{value}>.") | |
| raise FileNotFoundError(f"Path does not exist: <{value}>.") |
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.
I followed what is done elsewhere in the parser:
https://github.com/nipreps/fmriprep/blob/962f0b2e26d522d87ed786f12766001aa65e9dfd/fmriprep/cli/parser.py#L20-L24
but I have no problem changing it.
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.
sure that works too, though if you are following that example the function should be converted into a partial:
fmriprep/fmriprep/cli/parser.py
Lines 76 to 78 in c707938
| PathExists = partial(_path_exists, parser=parser) | |
| IsFile = partial(_is_file, parser=parser) | |
| PositiveInt = partial(_min_one, parser=parser) |
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.
oh right, my mistake. Would there be any advantage of making it a partial for that specific option?
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.
i think its necessary to pass in the defined parser
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.
Have we resolved this discussion? Would it be worth adding a test to make sure that it works, or are there tests in the CI that are covering the necessary cases?
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.
I think the partial call got lost in the latest rebase
|
Should this target |
--bids-filter-file should raise on error.--bids-filter-file should raise on error.
60abf7d to
607aa3b
Compare
|
@bpinsard I think the CI errors have been fixed, you'll need to rebase off the |
1a5dabc to
5127eb2
Compare
|
Rebase again? |
5127eb2 to
e412983
Compare
|
@bpinsard I added a test and fixed a bug. This LGTM at this point, feel free to merge when tests pass. |
Changes proposed in this pull request
Check if provided bids-filter-file path exists if not raise an error.
This should avoid cases when the user provides file filters and the pipeline silently runs on other set of file.
Documentation that should be reviewed
none