Skip to content
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

Remove md5sum for versions.yml file #1511

Merged
merged 10 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Very minor patch release to fix the full size AWS tests and re-run the template
- Remove traces of markdownlint in the template ([#1486](https://github.com/nf-core/tools/pull/1486)
- Remove accidentally added line in `CHANGELOG.md` in the template ([#1487](https://github.com/nf-core/tools/pull/1487))
- Update linting to check that `.editorconfig` is there and `.yamllint.yml` isn't.
- Don't save md5sum for `versions.yml` when running `nf-core modules create-test-yml` ([#1511](https://github.com/nf-core/tools/pull/1511))

## [v2.3.1 - Mercury Vulture Formatting](https://github.com/nf-core/tools/releases/tag/2.3.1) - [2022-03-23]

Expand Down
22 changes: 13 additions & 9 deletions nf_core/modules/test_yml_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,25 @@ def _md5(self, fname):
def create_test_file_dict(self, results_dir, is_repeat=False):
"""Walk through directory and collect md5 sums"""
test_files = []
for root, dir, file in os.walk(results_dir):
for elem in file:
elem = os.path.join(root, elem)
test_file = {"path": elem} # add the key here so that it comes first in the dict
for root, dir, files in os.walk(results_dir):
for filename in files:
# Check that the file is not versions.yml
if filename == "versions.yml":
continue
file_path = os.path.join(root, filename)
# add the key here so that it comes first in the dict
test_file = {"path": file_path}
# Check that this isn't an empty file
if self.check_if_empty_file(elem):
if self.check_if_empty_file(file_path):
if not is_repeat:
self.errors.append(f"Empty file found! '{os.path.basename(elem)}'")
self.errors.append(f"Empty file found! '{os.path.basename(file_path)}'")
# Add the md5 anyway, linting should fail later and can be manually removed if needed.
# Originally we skipped this if empty, but then it's too easy to miss the warning.
# Equally, if a file is legitimately empty we don't want to prevent this from working.
elem_md5 = self._md5(elem)
test_file["md5sum"] = elem_md5
file_md5 = self._md5(file_path)
test_file["md5sum"] = file_md5
# Switch out the results directory path with the expected 'output' directory
test_file["path"] = elem.replace(results_dir, "output")
test_file["path"] = file_path.replace(results_dir, "output")
test_files.append(test_file)

test_files = sorted(test_files, key=operator.itemgetter("path"))
Expand Down