Skip to content

Conversation

@bpinsard
Copy link
Collaborator

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

@pep8speaks
Copy link

pep8speaks commented Nov 18, 2020

Hello @bpinsard! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-06-23 16:24:46 UTC

@bpinsard bpinsard force-pushed the fix/bids-filter-file_pathexist branch 2 times, most recently from fc6c613 to 962f0b2 Compare November 18, 2020 19:07
Copy link
Collaborator

@mgxd mgxd left a 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

Comment on lines +64 to +68
Copy link
Collaborator

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?

Suggested change
else:
raise parser.error(f"Path does not exist: <{value}>.")
raise FileNotFoundError(f"Path does not exist: <{value}>.")

Copy link
Collaborator Author

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.

Copy link
Collaborator

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:

PathExists = partial(_path_exists, parser=parser)
IsFile = partial(_is_file, parser=parser)
PositiveInt = partial(_min_one, parser=parser)

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

Copy link
Member

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?

Copy link
Collaborator

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

@effigies
Copy link
Member

Should this target maint/20.2.x?

@bpinsard bpinsard changed the title FIX: non-existing path for --bids-filter-file should raise on error. FIX: non-existing path or JSON syntax error for --bids-filter-file should raise on error. Apr 13, 2021
@bpinsard bpinsard changed the base branch from master to maint/20.2.x April 13, 2021 14:43
@bpinsard bpinsard force-pushed the fix/bids-filter-file_pathexist branch from 60abf7d to 607aa3b Compare April 13, 2021 14:50
@mgxd
Copy link
Collaborator

mgxd commented Jun 21, 2021

@bpinsard I think the CI errors have been fixed, you'll need to rebase off the maint/20.2.x branch

@bpinsard bpinsard force-pushed the fix/bids-filter-file_pathexist branch from 1a5dabc to 5127eb2 Compare June 21, 2021 18:07
@effigies effigies mentioned this pull request Jun 22, 2021
@effigies
Copy link
Member

Rebase again?

@bpinsard bpinsard force-pushed the fix/bids-filter-file_pathexist branch from 5127eb2 to e412983 Compare June 23, 2021 02:07
@effigies
Copy link
Member

@bpinsard I added a test and fixed a bug. This LGTM at this point, feel free to merge when tests pass.

@effigies effigies merged commit f3b2cbb into nipreps:maint/20.2.x Jun 24, 2021
@bpinsard bpinsard deleted the fix/bids-filter-file_pathexist branch June 25, 2021 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants