Skip to content

Commit 06f48ff

Browse files
authored
Merge pull request #3665 from mirpedrol/fix-lint-fix
Fix wrong key when updating module outputs
2 parents a02b57a + f1e6650 commit 06f48ff

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
- Remove args stub from module template to satisfy language server ([#3403](https://github.com/nf-core/tools/pull/3403))
2424
- Fix modules meta.yml file structure ([#3532](https://github.com/nf-core/tools/pull/3532))
25+
- Fix wrong key when updating module outputs ([#3665](https://github.com/nf-core/tools/pull/3665))
2526

2627
### Subworkflows
2728

nf_core/modules/lint/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def _find_meta_info(meta_yml, element_name, is_output=False) -> dict:
324324
if isinstance(meta_channel, list):
325325
for x, meta_element in enumerate(meta_channel):
326326
if element_name == list(meta_element.keys())[0]:
327-
return meta_yml[k][x][element_name]
327+
return meta_yml[ch_name][k][x][element_name]
328328
elif isinstance(meta_channel, dict):
329329
if element_name == list(meta_channel.keys())[0]:
330330
return meta_yml[ch_name][k][element_name]
@@ -356,18 +356,18 @@ def _find_meta_info(meta_yml, element_name, is_output=False) -> dict:
356356
mod.outputs.copy()
357357
) # eg. { bam: [[ {meta:{}}, {*.bam:{}} ]], reference: [ {*.fa:{}} ] } -> 2 channels, a tuple (list) and a single path (dict)
358358
for ch_name in corrected_meta_yml["output"].keys():
359-
ch_content = corrected_meta_yml["output"][ch_name][0]
360-
if isinstance(ch_content, list):
361-
for i, element in enumerate(ch_content):
362-
element_name = list(element.keys())[0]
363-
corrected_meta_yml["output"][ch_name][0][i][element_name] = _find_meta_info(
359+
for i, ch_content in enumerate(corrected_meta_yml["output"][ch_name]):
360+
if isinstance(ch_content, list):
361+
for j, element in enumerate(ch_content):
362+
element_name = list(element.keys())[0]
363+
corrected_meta_yml["output"][ch_name][i][j][element_name] = _find_meta_info(
364+
meta_yml["output"], element_name, is_output=True
365+
)
366+
elif isinstance(ch_content, dict):
367+
element_name = list(ch_content.keys())[0]
368+
corrected_meta_yml["output"][ch_name][i][element_name] = _find_meta_info(
364369
meta_yml["output"], element_name, is_output=True
365370
)
366-
elif isinstance(ch_content, dict):
367-
element_name = list(ch_content.keys())[0]
368-
corrected_meta_yml["output"][ch_name][0][element_name] = _find_meta_info(
369-
meta_yml["output"], element_name, is_output=True
370-
)
371371

372372
def _add_edam_ontologies(section, edam_formats, desc):
373373
expected_ontologies = []

0 commit comments

Comments
 (0)