Repository: nf-core/tools

Issue:
Check for new withName syntax
The old syntax, e.g.

```
process$name
```
Will be replaced by 
```
process:withName
```
Which currently leads to an error while linting, see here

```
ICGC-featureCounts> nf-core lint .                                                                                                                                               (nf-core-lint) 

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'
    
Running pipeline tests  [##################------------------]   50%  'check_nextflow_config'

CRITICAL: Critical error: ('`nextflow config` returned non-zero error code: %s,\n   %s', 1, b"ERROR ~ Unable to parse config file: '/home/alex/IDEA/nf-core/ICGC-featureCounts/nextflow.config'\n\n  Compile failed for sources FixedSetSources[name='/groovy/script/ScriptACEE592A55CA6E05E4ED54DBAB544DAD']. Cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\n  /groovy/script/ScriptACEE592A55CA6E05E4ED54DBAB544DAD: 26: expecting '}', found ':' @ line 26, column 12.\n       .withName:fetch_encrypted_s3_url {\n                ^\n  \n  1 error\n\n\n")

INFO: Stopping tests...

INFO: ===========
 LINTING RESULTS
=================
  16 tests passed   0 tests had warnings   0 tests failed
```

Should we support both or just the new syntax? 



Discussion:
I vote for just the new.
But maybe put that as a warning instead of an error if it's using the old one
+1 for just supporting the new if we need to.

Note that the error there is from nextflow though, not the linting. Should probably print the newlines in that so that it's easier to read...

```
`nextflow config` returned non-zero error code: %s,
   %s', 1, b"ERROR ~ Unable to parse config file: '/home/alex/IDEA/nf-core/ICGC-featureCounts/nextflow.config'

  Compile failed for sources FixedSetSources[name='/groovy/script/ScriptACEE592A55CA6E05E4ED54DBAB544DAD']. Cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  /groovy/script/ScriptACEE592A55CA6E05E4ED54DBAB544DAD: 26: expecting '}', found ':' @ line 26, column 12.
       .withName:fetch_encrypted_s3_url {
                ^
  
  1 error
```

What version of nextflow is installed? It could be that the linting itself is fine..
I think that was 0.30.2, now with 0.31.0 the error is gone ?! 
Can we close this?
Yup - will do. I guess the linting is still fine :-) 

Though perhaps the linting should check for the new format and throw a warning / error about the old?
Agreed - I dont know when this will be not just a warning in Nextflow but an actual error message ? @pditommaso may know when this is the case ;-) 

Either way, we should definitely be using the new syntax for all pipelines now.
it will stay for a while as a warning, but I agree with Phil better to switch to the new syntax also because it's more flexible. 

Resolving patch:
diff --git a/nf_core/lint.py b/nf_core/lint.py
old mode 100644
new mode 100755
--- a/nf_core/lint.py
+++ b/nf_core/lint.py
@@ -309,6 +309,11 @@ def check_nextflow_config(self):
                 self.passed.append((4, "Config variable found: {}".format(cf)))
             else:
                 self.warned.append((4, "Config variable not found: {}".format(cf)))
+        
+        # Check and warn if the process configuration is done with deprecated syntax
+        process_with_deprecated_syntax = list(set([re.search('^(process\.\$.*?)\.+.*$', ck).group(1) for ck in self.config.keys() if re.match(r'^(process\.\$.*?)\.+.*$', ck)]))
+        for pd in process_with_deprecated_syntax:
+            self.warned.append((4, "Process configuration is done with deprecated_syntax: {}".format(pd)))
 
         # Check the variables that should be set to 'true'
         for k in ['timeline.enabled', 'report.enabled', 'trace.enabled', 'dag.enabled']:


Test patch:
diff --git a/tests/lint_examples/failing_example/nextflow.config b/tests/lint_examples/failing_example/nextflow.config
--- a/tests/lint_examples/failing_example/nextflow.config
+++ b/tests/lint_examples/failing_example/nextflow.config
@@ -1,3 +1,10 @@
 manifest.homePage = 'http://nf-co.re/pipelines'
 
 dag.file = "dag.html"
+
+process {
+    $deprecatedSyntax {
+        cpu = 1
+    }
+}
+
diff --git a/tests/test_lint.py b/tests/test_lint.py
--- a/tests/test_lint.py
+++ b/tests/test_lint.py
@@ -119,7 +119,7 @@ def test_config_variable_example_with_failed(self):
         """Tests that config variable existence test fails with bad pipeline example"""
         bad_lint_obj = nf_core.lint.PipelineLint(PATH_FAILING_EXAMPLE)
         bad_lint_obj.check_nextflow_config()
-        expectations = {"failed": 17, "warned": 8, "passed": 2}
+        expectations = {"failed": 17, "warned": 9, "passed": 2}
         self.assess_lint_status(bad_lint_obj, **expectations)
 
     @pytest.mark.xfail(raises=AssertionError)