Skip to content

nf-core modules lint errors out when there are unexpected labels  #1733

@awgymer

Description

@awgymer

Description of the bug

When running nf-core modules lint on a module which contains a label not starting process_ an AttributeError is raised and the process errors out. It might be better if it was either reported as failing linting or ignored?
i.e.

process MYPROC {
    label 'some_label'
    
    ...
}

As a side not I think that this would also fail if for some reason you had label in your container name - say there was tool called genome_labeller or something - because labels are found by the following which doesn't care where the term appears in the line:

process_label = [l for l in lines if "label" in l]

This could be changed to:

process_label = [l for l in lines if l.lstrip().startswith("label")]

Command used and terminal output

nf-core modules lint <somemodule>

/nf-core-tools/nf_core/modules/lint/main_nf.py:245 in check_process_section 
                                                                                                                
  244 │   if len(process_label) > 0:                                                                            
❱ 245 │   │   process_label = re.search("process_[A-Za-z]+", process_label[0]).group(0)                         
  246 │   │   if not process_label in correct_process_labels:                                                   

AttributeError: 'NoneType' object has no attribute 'group'

System information

nf-core/tools version 2.5.dev0
python 3.9.7
macOS

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions