-
Notifications
You must be signed in to change notification settings - Fork 243
Fix linting for modules.json to add support for only installing subworkflows from a repository
#4287
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
base: dev
Are you sure you want to change the base?
Fix linting for modules.json to add support for only installing subworkflows from a repository
#4287
Changes from all commits
cb5ce08
e90bc06
bfb649f
383d367
fd26c90
328219b
7be6722
acc2db6
4a3755d
2c305f9
1320832
d586a6d
75332c4
60a6e51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,45 @@ | ||
| import json | ||
|
|
||
| from nf_core.modules.modules_json import ( | ||
| ModulesJson, | ||
| ModulesJsonType, | ||
| ) | ||
|
|
||
| from ..test_lint import TestLint | ||
|
|
||
|
|
||
| class TestLintModulesJson(TestLint): | ||
| def setUp(self) -> None: | ||
| super().setUp() | ||
| self._modules_json_object: ModulesJson = ModulesJson(self.pipeline_dir) | ||
| self._modules_json_object.load() | ||
| self.modules_json_path = self._modules_json_object.modules_json_path | ||
| self.modules_json: ModulesJsonType | None = self._modules_json_object.modules_json | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This attribute can't actually be
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can just throw in an |
||
|
|
||
| def _update_modules_json(self, new_modules_json) -> None: | ||
| # Update modules_json so that it is concordant at all levels of the class | ||
| self.modules_json = new_modules_json | ||
| self._modules_json_object.modules_json = new_modules_json | ||
| with open(self.modules_json_path, "w") as modules_json_file: | ||
| json.dump(new_modules_json, modules_json_file) | ||
|
|
||
| def test_modules_json_pass(self): | ||
| self.lint_obj._load() | ||
| results = self.lint_obj.modules_json() | ||
| assert len(results.get("warned", [])) == 0 | ||
| assert len(results.get("failed", [])) == 0 | ||
| assert len(results.get("passed", [])) > 0 | ||
|
|
||
| def test_modules_json_with_only_subworkflow_entries(self): | ||
| # Create a new_modules_json with only "subworkflows" component for all repos | ||
| new_modules_json = self.modules_json | ||
| for repo in new_modules_json["repos"]: | ||
| new_modules_json["repos"][repo] = {"subworkflows": new_modules_json["repos"][repo]["subworkflows"]} | ||
|
|
||
| self._update_modules_json(new_modules_json) | ||
|
|
||
| # Check linting results | ||
| results = self.lint_obj.modules_json() | ||
| assert len(results.get("warned", [])) == 0 | ||
| assert len(results.get("failed", [])) == 0 | ||
| assert len(results.get("passed", [])) == 0 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the current set up there is no subworkflow linting so no
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, please do that. |
||
Uh oh!
There was an error while loading. Please reload this page.