Skip to content

Commit

Permalink
Merge pull request #21 from qbicsoftware/release-0.3.0
Browse files Browse the repository at this point in the history
Release 0.3.0
  • Loading branch information
sven1103 authored Sep 30, 2019
2 parents 1935585 + 43ff7dc commit 5314374
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
19 changes: 11 additions & 8 deletions rmageddon/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: qtest000_1_ranalysis_123
channels:
- bioconda
- r
- conda-forge
- defaults
dependencies:
- r-base=3.4.3
Expand Down
2 changes: 1 addition & 1 deletion tests/lint_examples/bad_example/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: qbicsoftware-dd-ranalyses-1.0
name: qtest000_1_ranalysis_123
channels:
- bioconda
- r
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: qtest000_1_ranalysis
channels:
- bioconda
- r
- conda-forge
- defaults
dependencies:
- r-base=3.4.3
Expand Down
9 changes: 9 additions & 0 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_code}}/environment.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 5314374

Please sign in to comment.