-
Notifications
You must be signed in to change notification settings - Fork 744
Warn when file() matches a collection of files #5507
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
Conversation
✅ Deploy Preview for nextflow-docs-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Is it appropriate to document |
|
Agreed, better to describe |
|
I've added a minor suggestion. Otherwise, the docs look good. |
5a93547 to
27345a6
Compare
|
Docs look good to me 👍 |
|
Since the change from |
file() matches a collection of filesSigned-off-by: Ben Sherman <[email protected]>
fb2ef13 to
d0d0c53
Compare
|
Reviving this PR. We removed several runtime warnings since they were more appropriate in the linter / language server. However, after reflecting on it more, I think this one needs to be a runtime warning, since the glob pattern is only evaluated at runtime. I kept it as a warning and enabled only in the strict syntax, so it shouldn't be too bothersome. |
christopher-hakkaart
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.
Added a couple of suggestion. Feel free to accept or reject.
Co-authored-by: Chris Hakkaart <[email protected]> Signed-off-by: Ben Sherman <[email protected]>
christopher-hakkaart
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.
Docs look good 👍
Looking at the standard library functions with an eye towards static type checking, the only problematic function is
file()which can return a single file or list of files based on the glob pattern.Rather than introduce some new function, I think we can transition
file()to be properly typed:file()matches a collection of filesfile()toPathand raise an error if the glob pattern matches zero or multiple filesNote that the glob pattern is still useful for
file()when you know it will match only one file but you don't want to spell it out. Raising an error when this assumption is wrong seems like the right approach to me, but of course we should keep it as a warning just for now.Not sure whether you want to add a test for the warning, but you can see it in action here: