Support modules with `exec:` blocks
With the current version, linting a module that has an exec: block yields the following error
╭─ [✗] 1 Module Test Failed ───────────────────────────────────────────────────╮
│ ╷ ╷ │
│ Module name │ File path │ Test message │
│╶─────────────────────┼──────────────────────────┼───────────────────────────╴│
│ hiccramalign/chunks │ modules/sanger-tol/hicc… │ when: condition has too │
│ │ │ many lines │
│ ╵ ╵ │
╰──────────────────────────────────────────────────────────────────────────────╯
This is because the parser is not aware of exec: blocks.
In this PR I simply add code to recognise exec: blocks and check that they don't exist together with script: or shell:
Best, Matthieu
PR checklist
- [x] This comment contains a description of changes (with reason)
- [ ]
CHANGELOG.mdis updated - [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] Documentation in
docsis updated
Codecov Report
:x: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 77.29%. Comparing base (9bff2b9) to head (2872af9).
:warning: Report is 5 commits behind head on dev.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| nf_core/modules/lint/main_nf.py | 50.00% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I think there is no explicit reason not to support it but :
- make sure that it is only recommend to use in certain contexts (e.g. not heavy jobs, as it runs on the head node)
- we need to ensure that the structure of the block itself is consistent... (harshil align etc)
For now I think it's fine to merge this (exec: is valid Nextflow), but we should have the maintainers team develop a couple extra points for the specs page :)
So far it seems people are half neutral half against supporting within nf-core/modules officially, but I dont think linting should complain about a valid nextflow syntax so again I would merge this now so people can happily have local modules
I agree with James's summary, we should support this in general but an nf-core module would need a convincing argument as to why we need exec there.
complain about a valid nextflow syntax
agreed, maybe as an improved later on, we can have stricter linting on the nf-core side to at least warn for execs (to Simon's point), but allow disableing this linting in a config file
complain about a valid nextflow syntax
agreed, maybe as an improved later on, we can have stricter linting on the nf-core side to at least warn for execs (to Simon's point), but allow disableing this linting in a config file
I think it is fine in nf-core pipelines, just not in the modules repo personally.
ah correct, I meant modules linting only
thanks for all the feedback! I am going to merge this PR then :)