Skip to content

Commit

Permalink
Add check to lint for deprecated syntax (#104)
Browse files Browse the repository at this point in the history
* Resolves #78

* Add test for lint
  • Loading branch information
senthil10 authored and apeltzer committed Aug 9, 2018
1 parent d497246 commit db5d5e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions nf_core/lint.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
7 changes: 7 additions & 0 deletions tests/lint_examples/failing_example/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
manifest.homePage = 'http://nf-co.re/pipelines'

dag.file = "dag.html"

process {
$deprecatedSyntax {
cpu = 1
}
}

2 changes: 1 addition & 1 deletion tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit db5d5e0

Please sign in to comment.