diff --git a/CHANGELOG.md b/CHANGELOG.md index d902443d8e..9f1abd1996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - Add `topics` to the template + update linting ([#3779](https://github.com/nf-core/tools/pull/3779)) - Preserve the value of self.modules_repo across nested calls ([#3881](https://github.com/nf-core/tools/pull/3881)) +- modules lint: handle meta.ymls without topics field ([#3909](https://github.com/nf-core/tools/pull/3909)) ### Subworkflows diff --git a/nf_core/modules/lint/__init__.py b/nf_core/modules/lint/__init__.py index 579bce05e6..0fb151e90a 100644 --- a/nf_core/modules/lint/__init__.py +++ b/nf_core/modules/lint/__init__.py @@ -303,6 +303,7 @@ def update_meta_yml_file(self, mod): if "output" in meta_yml: correct_outputs = self.obtain_outputs(mod.outputs) meta_outputs = self.obtain_outputs(meta_yml["output"]) + if "topics" in meta_yml: correct_topics = self.obtain_topics(mod.topics) meta_topics = self.obtain_topics(meta_yml["topics"]) @@ -370,7 +371,8 @@ def _find_meta_info(meta_yml, element_name, is_output=False) -> dict: corrected_meta_yml["output"][ch_name][i][element_name] = _find_meta_info( meta_yml["output"], element_name, is_output=True ) - elif "topics" in meta_yml and correct_topics != meta_topics: + + if "topics" in meta_yml and correct_topics != meta_topics: log.debug( f"Correct topics: '{correct_topics}' differ from current topics: '{meta_topics}' in '{mod.meta_yml}'" )