From affb710692d5eeb056d2477cd60fe197259c898b Mon Sep 17 00:00:00 2001
From: Nicolas Vannieuwkerke <nicolas.vannieuwkerke@ugent.be>
Date: Thu, 4 May 2023 16:08:55 +0200
Subject: [PATCH 1/2] Add stub to the modules template

---
 nf_core/module-template/modules/main.nf | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/nf_core/module-template/modules/main.nf b/nf_core/module-template/modules/main.nf
index 83cdf90b92..404d38094d 100644
--- a/nf_core/module-template/modules/main.nf
+++ b/nf_core/module-template/modules/main.nf
@@ -94,4 +94,26 @@ process {{ component_name_underscore|upper }} {
         {{ tool }}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
     END_VERSIONS
     """
+
+    stub:
+    def args = task.ext.args ?: ''
+    {% if has_meta -%}
+    def prefix = task.ext.prefix ?: "${meta.id}"
+    {%- endif %}
+    {% if not_empty_template -%}
+    // TODO nf-core: A stub section should mimic the execution of the original module as best as possible
+    //               Have a look at the following examples:
+    //               Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63
+    //               Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54
+    {%- endif %}
+    """
+    {% if not_empty_template -%}
+    touch ${prefix}.bam
+    {%- endif %}
+
+    cat <<-END_VERSIONS > versions.yml
+    "${task.process}":
+        {{ tool }}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
+    END_VERSIONS
+    """
 }

From 232b11de33b8cb93a77b85e0439d7e236a5f8206 Mon Sep 17 00:00:00 2001
From: Nicolas Vannieuwkerke <nicolas.vannieuwkerke@ugent.be>
Date: Fri, 5 May 2023 09:00:07 +0200
Subject: [PATCH 2/2] updated changelog

---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3c0792519..4a62d70aa0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
 
 ### Template
 
+- Added stub in modules template ([#2277])(https://github.com/nf-core/tools/pull/2277)
+
 ### Linting
 
 - Warn if container access is denied ([#2270](https://github.com/nf-core/tools/pull/2270))