Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for singularity file and raise error if found #460

Merged
merged 6 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Updated Blacklist of synced pipelines
* Ignore pre-releases in `nf-core list`
* Lint for `Singularity` file [and remove it](https://github.com/nf-core/tools/issues/458)

### Template

Expand Down
4 changes: 4 additions & 0 deletions docs/lint_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,7 @@ The nf-core workflow template contains a number of comment lines with the follow
```

This lint test runs through all files in the pipeline and searches for these lines.

## Error #11 - Singularity file found ##{#11}

As we are relying on [Docker Hub](https://https://hub.docker.com/) instead of Singularity and all containers are automatically pulled from there, repositories should not have a `Singularity` file present.
7 changes: 7 additions & 0 deletions nf_core/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def lint_pipeline(self, release_mode=False):
'check_files_exist',
'check_licence',
'check_docker',
'check_singularity',
'check_nextflow_config',
'check_ci_config',
'check_readme',
Expand Down Expand Up @@ -277,6 +278,12 @@ def check_docker(self):

self.failed.append((2, "Dockerfile check failed"))

def check_singularity(self):
"""Checks whether a Singularity file exists and warns to remove that file then."""
fn = os.path.join(self.path, "Singularity")
if(path.exists(fn)):
self.failed.append((11, "Singularity file exists"))

def check_licence(self):
"""Checks licence file is MIT.

Expand Down
1 change: 1 addition & 0 deletions tests/lint_examples/failing_example/Singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Nothing to be found here
7 changes: 7 additions & 0 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ def test_mit_license_example_with_failed(self):
bad_lint_obj.check_licence()
expectations = {"failed": 1, "warned": 0, "passed": 0}
self.assess_lint_status(bad_lint_obj, **expectations)

def test_singularity_with_failed(self):
"""Tests that Singularity file doesn't exist"""
bad_lint_obj = nf_core.lint.PipelineLint(PATH_FAILING_EXAMPLE)
bad_lint_obj.check_singularity()
expectations = {"failed": 1, "warned": 0, "passed": 33}
self.assess_lint_status(bad_lint_obj, **expectations)

def test_config_variable_example_pass(self):
"""Tests that config variable existence test works with good pipeline example"""
Expand Down