Skip to content

Commit d26c3e9

Browse files
authored
Merge pull request #3280 from mirpedrol/run-pre-commit-with-lint-tests
General: Run pre-commit when testing linting the template pipeline
2 parents 0848508 + 269af7d commit d26c3e9

File tree

7 files changed

+60
-27
lines changed

7 files changed

+60
-27
lines changed

.github/workflows/create-test-lint-wf-template.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ jobs:
152152
run: nf-core --log-file log.txt --hide-progress pipelines lint --dir my-prefix-testpipeline --fail-warned
153153
working-directory: create-test-lint-wf
154154

155+
# Run code style linting
156+
- name: run pre-commit
157+
shell: bash
158+
run: pre-commit run --all-files
159+
working-directory: create-test-lint-wf
160+
155161
# Run bump-version
156162
- name: nf-core pipelines bump-version
157163
run: nf-core --log-file log.txt pipelines bump-version --dir my-prefix-testpipeline/ 1.1

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
### Linting
1919

20+
- General: Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
21+
2022
### Modules
2123

2224
- add a panel around diff previews when updating ([#3246](https://github.com/nf-core/tools/pull/3246))

nf_core/pipeline-template/conf/modules.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ process {
1818
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
1919
]
2020

21-
{% if fastqc -%}
21+
{%- if fastqc %}
22+
2223
withName: FASTQC {
2324
ext.args = '--quiet'
2425
}
2526
{%- endif %}
2627

2728
{%- if multiqc %}
29+
2830
withName: 'MULTIQC' {
2931
ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' }
3032
publishDir = [

nf_core/pipeline-template/main.nf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ workflow {
109109
{%- endif %}
110110
params.outdir,
111111
params.monochrome_logs,
112-
{% if adaptivecard or slackreport %}params.hook_url,{% endif %}
113-
{% if multiqc %}{{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report{% endif %}
112+
{%- if adaptivecard or slackreport %}
113+
params.hook_url,{% endif %}
114+
{%- if multiqc %}
115+
{{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report{% endif %}
114116
)
115117
{%- endif %}
116118
}

nf_core/pipeline-template/nextflow.config

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,47 @@ params {
1313
// Input options
1414
input = null
1515

16-
{% if igenomes -%}
16+
{%- if igenomes %}
17+
1718
// References
1819
genome = null
1920
igenomes_base = 's3://ngi-igenomes/igenomes/'
2021
igenomes_ignore = false
2122
{%- endif %}
2223

23-
{% if multiqc -%}
24+
{%- if multiqc %}
25+
2426
// MultiQC options
2527
multiqc_config = null
2628
multiqc_title = null
2729
multiqc_logo = null
2830
max_multiqc_email_size = '25.MB'
29-
{% if citations %}multiqc_methods_description = null{% endif %}
31+
{%- if citations %}
32+
multiqc_methods_description = null{% endif %}
3033
{%- endif %}
3134

3235
// Boilerplate options
3336
outdir = null
34-
{% if modules %}publish_dir_mode = 'copy'{% endif %}
37+
{%- if modules %}
38+
publish_dir_mode = 'copy'{% endif %}
3539
{%- if email %}
3640
email = null
3741
email_on_fail = null
3842
plaintext_email = false
3943
{%- endif %}
40-
{% if modules %}monochrome_logs = false{% endif %}
41-
{% if slackreport or adaptivecard %}hook_url = null{% endif %}
42-
{% if nf_schema %}help = false
44+
{%- if modules %}
45+
monochrome_logs = false{% endif %}
46+
{%- if slackreport or adaptivecard %}
47+
hook_url = null{% endif %}
48+
{%- if nf_schema %}
49+
help = false
4350
help_full = false
4451
show_hidden = false{% endif %}
4552
version = false
46-
{% if test_config %}pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'{% endif %}
53+
{%- if test_config %}
54+
pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'{% endif %}
4755

48-
{% if nf_core_configs -%}
56+
{%- if nf_core_configs -%}
4957
// Config options
5058
config_profile_name = null
5159
config_profile_description = null
@@ -56,7 +64,8 @@ params {
5664
config_profile_url = null
5765
{%- endif %}
5866

59-
{% if nf_schema -%}
67+
{%- if nf_schema %}
68+
6069
// Schema validation default options
6170
validate_params = true
6271
{%- endif %}
@@ -173,7 +182,7 @@ profiles {
173182
wave.freeze = true
174183
wave.strategy = 'conda,container'
175184
}
176-
{% if gitpod -%}
185+
{%- if gitpod %}
177186
gitpod {
178187
executor.name = 'local'
179188
executor.cpus = 4
@@ -187,7 +196,7 @@ profiles {
187196
}
188197
}
189198
{%- endif %}
190-
{% if test_config -%}
199+
{%- if test_config %}
191200
test { includeConfig 'conf/test.config' }
192201
test_full { includeConfig 'conf/test_full.config' }
193202
{%- endif %}

nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ workflow PIPELINE_COMPLETION {
128128
{%- endif %}
129129
outdir // path: Path to output directory where results will be published
130130
monochrome_logs // boolean: Disable ANSI colour codes in log output
131-
{% if adaptivecard or slackreport %}hook_url // string: hook URL for notifications{% endif %}
132-
{% if multiqc %}multiqc_report // string: Path to MultiQC report{% endif %}
131+
{%- if adaptivecard or slackreport %}
132+
hook_url // string: hook URL for notifications{% endif %}
133+
{%- if multiqc %}
134+
multiqc_report // string: Path to MultiQC report{% endif %}
133135

134136
main:
135137
{%- if nf_schema %}
@@ -237,8 +239,10 @@ def toolCitationText() {
237239
// Uncomment function in methodsDescriptionText to render in MultiQC report
238240
def citation_text = [
239241
"Tools used in the workflow included:",
240-
{% if fastqc %}"FastQC (Andrews 2010),",{% endif %}
241-
{% if multiqc %}"MultiQC (Ewels et al. 2016)",{% endif %}
242+
{%- if fastqc %}
243+
"FastQC (Andrews 2010),",{% endif %}
244+
{%- if multiqc %}
245+
"MultiQC (Ewels et al. 2016)",{% endif %}
242246
"."
243247
].join(' ').trim()
244248

@@ -250,8 +254,10 @@ def toolBibliographyText() {
250254
// Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "<li>Author (2023) Pub name, Journal, DOI</li>" : "",
251255
// Uncomment function in methodsDescriptionText to render in MultiQC report
252256
def reference_text = [
253-
{% if fastqc %}"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",{% endif %}
254-
{% if multiqc %}"<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>"{% endif %}
257+
{%- if fastqc %}
258+
"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",{% endif %}
259+
{%- if multiqc %}
260+
"<li>Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354</li>"{% endif %}
255261
].join(' ').trim()
256262

257263
return reference_text

nf_core/pipeline-template/workflows/pipeline.nf

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
*/
66

77
{%- if modules %}
8-
{% if fastqc %}include { FASTQC } from '../modules/nf-core/fastqc/main'{% endif %}
9-
{% if multiqc %}include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %}
10-
{% if nf_schema %}include { paramsSummaryMap } from 'plugin/nf-schema'{% endif %}
11-
{% if multiqc %}include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %}
8+
{%- if fastqc %}
9+
include { FASTQC } from '../modules/nf-core/fastqc/main'{% endif %}
10+
{%- if multiqc %}
11+
include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %}
12+
{%- if nf_schema %}
13+
include { paramsSummaryMap } from 'plugin/nf-schema'{% endif %}
14+
{%- if multiqc %}
15+
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %}
1216
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
13-
{% if citations or multiqc %}include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'{% endif %}
17+
{%- if citations or multiqc %}
18+
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'{% endif %}
1419
{%- endif %}
1520

1621
/*
@@ -28,7 +33,8 @@ workflow {{ short_name|upper }} {
2833
main:
2934

3035
ch_versions = Channel.empty()
31-
{% if multiqc %}ch_multiqc_files = Channel.empty(){% endif %}
36+
{%- if multiqc %}
37+
ch_multiqc_files = Channel.empty(){% endif %}
3238

3339
{%- if fastqc %}
3440
//

0 commit comments

Comments
 (0)