What do people think about some module standardiza...
# team-maintainers
s
What do people think about some module standardization proposals below (some inspired from @Edmund's recent changes to trimmomatic module): 1. All groovy variables to be consistently enclosed with curly brackets:
$meta.id
->
${meta.id}
2. Ternary operators to be clearly separated on new lines starting with
?
&
:
old
Copy code
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
        'https://depot.galaxyproject.org/singularity/abritamr:1.0.14--pyhdfd78af_0':
        'biocontainers/abritamr:1.0.14--pyhdfd78af_0' }"
new
Copy code
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
        ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b6/b6078836553c48db86c8a1d126ca764bc812b11aaeb7222299fe7be3a06ed68e/data'
        : 'community.wave.seqera.io/library/abritamr:6aee07e42fbc9d88' }"
3. For nf-test assertions, instead of
process.out
which results in output elements captured twice in the snapshot (indexed & named), capture each output element explicitly. This might be a bit more work but, it also makes sure that the test creator is conscious of the output being captured in the snapshot and easily manipulate channels that are non-deterministic and also result in only one set of capture i.e., named
old
Copy code
{ assert snapshot(process.out).match() }
new
Copy code
{ assert snapshot(
            process.out.matches,
            process.out.partials,
            process.out.virulence,
            process.out.out,
            process.out.txt,
            process.out.versions,
            path(process.out.versions[0]).yaml
).match() },
4. Along with
process.out.versions
also capture the version number of the tool explicitly in the snapshot with
path(process.out.versions[0]).yaml
. This is to help a reviewer with quick and easy validation that the version in
environment.yml
matches with the one captured in snapshot and helps with easy reviews during version bumps
old
Copy code
[
  "versions.yml:md5,763ada34dd99832aebcc535acacdc3d1"
],
new
Copy code
[
    "versions.yml:md5,763ada34dd99832aebcc535acacdc3d1"
],
{
    "ABRITAMR_RUN": "1.0.19"
}
5. All modules to have STUB and
- stub
tests - mandatory These were some thoughts I had in mind to achieve more consistency across modules. example implementation PR here. We might be already doing some of these but, would be nice to get consensus and update PR review guidelines accordingly
👍🏻 1
👍 1
m
ad 2) ternary’s should and in
?
to make them easier to identify and understand, see this deep dive from prettier (it’s about nested ones, but holds true here as well I think) https://prettier.io/blog/2023/11/13/curious-ternaries
ad 4) what about modules with multiple versions in the versions.yml?
I thought 5) was already the case?
m
I don't agree on 3, I think this is more an issue coming from the nf-test side, so I'd rather we keep it simple
for 4, I think we already have a POC about how it should look like with topics
2 is coming from the language server, right?
1, I'm ok
5, I'd say even more, that each test should have a stub counterpart and the number of output and name should be as close to real life as possible
👍 1
n
I agree with Maxime, especially on number 3. Some outputs can be skipped during tests if you do it this way
j
Yeah, 3 should be fixed at the nf-test level if anywhere IMO (I have no strong views on the others)
s
For 4, I'd rather only use
path(process.out.versions[0]).yaml
, don't see any benefit from having the md5sum too.
👍 1
e
I agree with all of them(I might be a little biased 😬) 1 and 2 are lsp formatting. Unless people want to start figuring out how to hack on the formatter, we're at the mercy of Ben. 3 is going to happen for the automatic updates. I don't really like double-snapshotting the version hash and the version yaml. Those will be gone when we adopt topic channels anyway. It feels like we're skating to where the puck is instead of where the puck is going. 4. Idk why we wouldn't do this, it makes it way easier to see what failed. 5 was already mandatory(ideal)
m
@Edmund didn't you had a POC for 4?
m
yeah, so that's what @Sateesh_Peri is proposing
Alrighty for me
s
ya I am also good with
4.
being just the yaml just that, we have to remove the lint warning for versions md5 not being there
❤️ 1
m
we just need to pay attention to the .yml because that will probably change with topics/eval
so let's make sure we have linting in sync with what we want to implement
✅ 3
s
cc @Famke Bäuerle
so, 1. is good to go and to be implemented right away - update docs 2. check if it breaks pipeline download 3. stick to
process.out
for now as publish outputs get updated 4.
path(process.out.versions[0]).yaml
is better. update tools lint check for this rather than versions md5 5. seems mandatory already agree ?
👍 1
f
so 4. we always add if otherwise we use
process.out
?
s
good point....it should be both
Copy code
process.out,
path(process.out.versions[0]).yaml
👍 1
f
Also in the stub?
s
stub maybe not required i think ?....just
process.out
should do ?
m
I wouldn't care much about the versions as we'll evolve that soon with topics
But as a personal preference, I'd rather have similar snaps for me normal and stub tests
💯 2
e
It makes me want a nft-utils function to say
Copy code
assertAll(
{nf-core-best-practices},
{assert somethingelse}
)
and the
nf-core-best-practices
is
Copy code
process.out,
path(process.out.versions[0]).yaml
But we could loop through
process.out
s
Can we add moving
assert process.success
onto its own line, outside of the
assertAll
, so that if the module fails it doesn't try and compare the snapshots.
👍 2