diff --git a/CHANGELOG.md b/CHANGELOG.md index 261c98753c..7a9e0bae9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) ### Linting diff --git a/docs/lint_errors.md b/docs/lint_errors.md index afd986ae5b..84c02e227d 100644 --- a/docs/lint_errors.md +++ b/docs/lint_errors.md @@ -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. diff --git a/nf_core/lint.py b/nf_core/lint.py index 97c9d12436..2a5bc4e017 100755 --- a/nf_core/lint.py +++ b/nf_core/lint.py @@ -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', @@ -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(os.path.exists(fn)): + self.failed.append((11, "Singularity file exists")) + def check_licence(self): """Checks licence file is MIT. diff --git a/tests/lint_examples/failing_example/Singularity b/tests/lint_examples/failing_example/Singularity new file mode 100644 index 0000000000..02e88c8045 --- /dev/null +++ b/tests/lint_examples/failing_example/Singularity @@ -0,0 +1 @@ +Nothing to be found here \ No newline at end of file diff --git a/tests/test_lint.py b/tests/test_lint.py index 16366e5f5f..6dd8129341 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -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": 0} + 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"""