diff --git a/CHANGELOG.md b/CHANGELOG.md index c0da4ab..bb811fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ +## 0.3.0 +- Removes r channel +- Requires bioconda and conda-forge as manadatory channels +- Template has been adjusted to pass linting + ## 0.1.1: Hotfix - Fix failing PyPi deployment diff --git a/rmageddon/lint.py b/rmageddon/lint.py index 2e595a2..86b88b3 100644 --- a/rmageddon/lint.py +++ b/rmageddon/lint.py @@ -82,7 +82,10 @@ def check_files_exist(self): self.passed.append((1, 'Dir {} found.'.format(files))) if os.path.isfile(self.pf('environment.yml')): - with open(self.pf('environment.yml'), 'r') as fh: + self.load_environment_config() + + def load_environment_config(self): + with open(self.pf('environment.yml'), 'r') as fh: yaml = YAML() self.conda_config = yaml.load(fh) @@ -184,13 +187,14 @@ def check_conda_environment(self): # Define the mandatory conda channels (min. requirement) mand_channel_settings = [ 'defaults', - 'r' + 'conda-forge', + 'bioconda' ] - + # Check that the mandatory conda env declarations are there - for declaration in mand_conda_settings: - if not self.conda_config.get(declaration): - self.failed.append((3, f"The conda env declaration \'{declaration}\' is missing.")) + for setting in mand_conda_settings: + if not self.conda_config.get(setting): + self.failed.append((3, f"The conda environment setting \'{setting}\' is missing.")) return # Check the name regex @@ -202,10 +206,9 @@ def check_conda_environment(self): Make sure, it follows the guidelines.")) return - # Check that channels 'default' and 'r' are present + # Find missing channels missing_channels = list([ch for ch in mand_channel_settings if not ch in self.conda_config.get('channels')]) - for ch in missing_channels: self.failed.append((3, f"Channel {ch} was not defined.")) return diff --git a/setup.py b/setup.py index af28563..f7f7286 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages import sys -version = '0.2.2' +version = '0.3.0' with open('README.md') as f: readme = f.read() diff --git a/tests/lint_examples/awesome_working_example/environment.yml b/tests/lint_examples/awesome_working_example/environment.yml index 3a5cd27..2505f30 100644 --- a/tests/lint_examples/awesome_working_example/environment.yml +++ b/tests/lint_examples/awesome_working_example/environment.yml @@ -1,7 +1,7 @@ name: qtest000_1_ranalysis_123 channels: - bioconda - - r + - conda-forge - defaults dependencies: - r-base=3.4.3 diff --git a/tests/lint_examples/bad_example/environment.yml b/tests/lint_examples/bad_example/environment.yml index 214ea4f..5cad9f0 100644 --- a/tests/lint_examples/bad_example/environment.yml +++ b/tests/lint_examples/bad_example/environment.yml @@ -1,4 +1,4 @@ -name: qbicsoftware-dd-ranalyses-1.0 +name: qtest000_1_ranalysis_123 channels: - bioconda - r diff --git a/tests/lint_examples/minimal_working_example/environment.yml b/tests/lint_examples/minimal_working_example/environment.yml index 28a6030..fe19fa3 100644 --- a/tests/lint_examples/minimal_working_example/environment.yml +++ b/tests/lint_examples/minimal_working_example/environment.yml @@ -1,7 +1,7 @@ name: qtest000_1_ranalysis channels: - bioconda - - r + - conda-forge - defaults dependencies: - r-base=3.4.3 diff --git a/tests/test_lint.py b/tests/test_lint.py index ef17cca..5a2d02b 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -103,6 +103,15 @@ def test_rpackage_empty_warn(self): expectations = {"failed": 1, "warned": 0, "passed": 0} self.assess_lint_status(lint_obj, **expectations) + def test_semantic_version_container_fail(self): + """ If the container version does not follow the sematic versioning + style-guide, the linting should fail.""" + lint_obj = lint.RContainerLint(PATH_BAD_EXAMPLE) + lint_obj.load_environment_config() + lint_obj.check_conda_environment() + expectations = {"failed": 1, "warned": 0, "passed": 0} + self.assess_lint_status(lint_obj, **expectations) + def test_rpackage_pass(self): """ Check if the rpackages.txt is formatted correctly """ lint_obj = lint.RContainerLint(PATH_MINIMAL_WORKING_EXAMPLE) diff --git a/{{cookiecutter.project_code}}/environment.yml b/{{cookiecutter.project_code}}/environment.yml index 599ee9c..75e7e8f 100644 --- a/{{cookiecutter.project_code}}/environment.yml +++ b/{{cookiecutter.project_code}}/environment.yml @@ -1,7 +1,7 @@ name: {{ cookiecutter.project_code }}000_{{ cookiecutter.project_label }}_ranalysis{{ cookiecutter.container_version }} channels: + - conda-forge - bioconda - - r - defaults dependencies: - r-base={{ cookiecutter.r_version }}