Skip to content

Fix lint and update crash when module patch removes YAML separators - #4617

Merged
mashehu merged 4 commits into
nf-core:devfrom
Elifbusra:fix-patch-dash-header
Nov 25, 2026
Merged

mashehu merged 4 commits into
nf-core:devfrom
Elifbusra:fix-patch-dash-header

Conversation

@Elifbusra

Copy link
Copy Markdown

The check line.startswith("---") was meant to find file header lines like --- path/to/file in per_file_patch. But it also matched ----, the line a patch writes when a --- line is removed. That line has no space, so line.split(" ") failed and the code crashed.

The fix checks for "--- " (with a space) so that only the file header lines are chosen. Added a test that writes a small patch file with one header and one removed --- line, reads it with per_file_patch, and checks that the result has only one file and that ---- is still kept as a change line. Closes #3281.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!

AI use

Used Claude Code to find the bug and used it as a tutor and to check my work for accuracy and formatting. I wrote the test, fix and every communication line. I've reviewed and understand all the changes.

The check `line.startswith("---")` was meant to find file header lines
like `--- path/to/file`. But it also matched `----`, the line a patch
writes when a `---` line is removed. That line has no space, so
`line.split(" ")` failed and the code crashed.

The fix checks for `"--- "` (with a space) so that only the file header
lines are chosen.

Add a test that writes a small patch file with one header and one
removed `---` line, reads it with `per_file_patch`, and checks that the
result has only one file and that `----` is still kept as a change line.

Closes nf-core#3281
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.03%. Comparing base (181dff1) to head (250c30e).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will regress 1 benchmark

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 10 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_pipelines_schema_lint 203 ms 226.4 ms -10.33%
⚡ test_modules_update 1,215.8 ms 979.9 ms +24.08%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Elifbusra:fix-patch-dash-header (250c30e) with dev (181dff1)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@mashehu
mashehu requested a review from a team as a code owner November 25, 2026 12:55
@mashehu
mashehu enabled auto-merge (squash) November 25, 2026 13:27

@mashehu mashehu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@mashehu
mashehu merged commit 3b26626 into nf-core:dev Nov 25, 2026
125 of 126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants