-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from KevinMenden/lint-refactoring
Some additions
- Loading branch information
Showing
7 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/usr/bin/env python | ||
|
||
import nf_core.lint | ||
import os | ||
import yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import yaml | ||
import nf_core.lint | ||
|
||
def test_files_exist_missing_config(self): | ||
"""Lint test: critical files missing FAIL""" | ||
new_pipeline = self._make_pipeline_copy() | ||
|
||
os.remove(os.path.join(new_pipeline, "nextflow.config")) | ||
|
||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
results = lint_obj.files_exist() | ||
assert results["failed"] == ["File not found: `nextflow.config`"] | ||
|
||
def test_files_exist_missing_main(self): | ||
"""Check if missing main issues warning""" | ||
new_pipeline = self._make_pipeline_copy() | ||
|
||
os.remove(os.path.join(new_pipeline, "main.nf")) | ||
|
||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
results = lint_obj.files_exist() | ||
assert results["warned"] == ["File not found: `main.nf`"] | ||
|
||
def test_files_exist_depreciated_file(self): | ||
"""Check whether depreciated file issues warning""" | ||
new_pipeline = self._make_pipeline_copy() | ||
|
||
nf = os.path.join(new_pipeline, "parameters.settings.json") | ||
os.system("touch {}".format(nf)) | ||
|
||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
results = lint_obj.files_exist() | ||
assert results["failed"] == ["File must be removed: `parameters.settings.json`"] | ||
|
||
def test_files_exist_pass(self): | ||
"""Lint check should pass if all files are there""" | ||
|
||
new_pipeline = self._make_pipeline_copy() | ||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
results = lint_obj.files_exist() | ||
assert results["failed"] == [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import yaml | ||
import nf_core.lint | ||
|
||
def test_licence_pass(self): | ||
"""Lint test: check a valid MIT licence""" | ||
new_pipeline = self._make_pipeline_copy() | ||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
results = lint_obj.licence() | ||
assert results["passed"] == ["Licence check passed"] | ||
|
||
def test_licence_fail(self): | ||
"""Lint test: invalid MIT licence""" | ||
new_pipeline = self._make_pipeline_copy() | ||
lint_obj = nf_core.lint.PipelineLint(new_pipeline) | ||
lint_obj._load() | ||
|
||
fh = open(os.path.join(new_pipeline, "LICENSE"), "a") | ||
fh.write("[year]") | ||
fh.close() | ||
|
||
results = lint_obj.licence() | ||
assert results["failed"] == ["Licence file contains placeholders: {}".format(os.path.join(new_pipeline, "LICENSE"))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters