The fair-bioheaders people are using the following...
# team-maintainers
a
The fair-bioheaders people are using the following construct in their proposed modules, is anyone here able to tell me if it’s a pattern you are happy to introduce/is already approved:
Copy code
def quote = { value -> "'" + value.toString().replace("'", "'\\''") + "'" }

...

"""
...

${quote.call(metadata)}

...

"""
m
I kind of need more context as to what they need it for. It looks to be some kind of escape pattern, but why are they doing this?
a
Well I thought it was text content but I have since realised it's escaping the filename. Since no other module does this I am inclined to say if someone has
'
in their filename then that's on them and we shouldn't account for it
agree 4
m
Sounds like it could be it's own module to sanitize inputs rather than having that everywhere
this 1
p
Could also be a validation check in nf-schema or similar, to reject paths like that
m
I thought that Nextflow was already quoting variables automatically so that we can declare our modules like
Copy code
script:
"""
  blast ${file1} ${file2}
"""
without having to bother
m
I don't remember that being the case as we've often taken advantage of not quoting so it flexibly deals with lists of files and single files
m
That’s not necessary mutually exclusive. The interpolation could still list all elements from the list and quote each of them. Like an implicit
"$@"
.
👍🏽 1
j
If I recall correctly, I think Nextflow only quotes if specific characters are present in the file name
But it seems this will change with typed processes, where we are going to be required to join lists to strings ourselves
😧 1