Skip to content

Commit

Permalink
Merge pull request #2952 from mirpedrol/subworkflows-lint
Browse files Browse the repository at this point in the history
Components: set correct sha before running component lint tests
  • Loading branch information
mirpedrol authored May 6, 2024
2 parents 98abe32 + 65f7647 commit fec0ca8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

- Only match assignments of params in `main.nf` and not references like `params.aligner == <something>` ([#2833](https://github.com/nf-core/tools/pull/2833))
- Include test for presence of versions in snapshot ([#2888](https://github.com/nf-core/tools/pull/2888))
- Components: set correct sha before running component lint tests ([#2952](https://github.com/nf-core/tools/pull/2952))

### Download

Expand Down
5 changes: 5 additions & 0 deletions nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ def lint_module(self, mod, progress_bar, registry, local=False, fix_version=Fals

# Otherwise run all the lint tests
else:
if self.repo_type == "pipeline" and self.modules_json:
# Set correct sha
version = self.modules_json.get_module_version(mod.component_name, mod.repo_url, mod.org)
mod.git_sha = version

for test_name in self.lint_tests:
if test_name == "main_nf":
getattr(self, test_name)(mod, fix_version, self.registry, progress_bar)
Expand Down
5 changes: 5 additions & 0 deletions nf_core/subworkflows/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ def lint_subworkflow(self, swf, progress_bar, registry, local=False):

# Otherwise run all the lint tests
else:
if self.repo_type == "pipeline" and self.modules_json:
# Set correct sha
version = self.modules_json.get_subworkflow_version(swf.component_name, swf.repo_url, swf.org)
swf.git_sha = version

for test_name in self.lint_tests:
getattr(self, test_name)(swf)

Expand Down
4 changes: 2 additions & 2 deletions nf_core/synced_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ def component_files_identical(self, component_name, base_path, commit, component
component_dir = self.get_component_dir(component_name, component_type)
for file in component_files:
try:
files_identical[file] = filecmp.cmp(os.path.join(component_dir, file), os.path.join(base_path, file))
files_identical[file] = filecmp.cmp(Path(component_dir, file), Path(base_path, file))
except FileNotFoundError:
log.debug(f"Could not open file: {os.path.join(component_dir, file)}")
log.debug(f"Could not open file: {Path(component_dir, file)}")
continue
self.checkout_branch()
return files_identical
Expand Down

0 comments on commit fec0ca8

Please sign in to comment.