Repository: nf-core/tools

Issue:
nf-core modules lint errors out when there are unexpected labels 
### 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:

```python
process_label = [l for l in lines if "label" in l]
``` 

This could be changed to:

```python
process_label = [l for l in lines if l.lstrip().startswith("label")]
```

### Command used and terminal output

```console
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


Discussion:

Resolving patch:
diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py
--- a/nf_core/modules/lint/main_nf.py
+++ b/nf_core/modules/lint/main_nf.py
@@ -240,19 +240,23 @@ def check_process_section(self, lines, fix_version, progress_bar):
 
     # Check that process labels are correct
     correct_process_labels = ["process_low", "process_medium", "process_high", "process_long"]
-    process_label = [l for l in lines if "label" in l]
+    process_label = [l for l in lines if l.lstrip().startswith("label")]
     if len(process_label) > 0:
-        process_label = re.search("process_[A-Za-z]+", process_label[0]).group(0)
-        if not process_label in correct_process_labels:
-            self.warned.append(
-                (
-                    "process_standard_label",
-                    f"Process label ({process_label}) is not among standard labels: `{'`,`'.join(correct_process_labels)}`",
-                    self.main_nf,
+        try:
+            process_label = re.search("process_[A-Za-z]+", process_label[0]).group(0)
+        except AttributeError:
+            process_label = re.search("'([A-Za-z_-]+)'", process_label[0]).group(0)
+        finally:
+            if not process_label in correct_process_labels:
+                self.warned.append(
+                    (
+                        "process_standard_label",
+                        f"Process label ({process_label}) is not among standard labels: `{'`,`'.join(correct_process_labels)}`",
+                        self.main_nf,
+                    )
                 )
-            )
-        else:
-            self.passed.append(("process_standard_label", "Correct process label", self.main_nf))
+            else:
+                self.passed.append(("process_standard_label", "Correct process label", self.main_nf))
     else:
         self.warned.append(("process_standard_label", "Process label unspecified", self.main_nf))
     for l in lines:


Test patch: