Add CI step for checking redundant test patches by ShaharNaveh · Pull Request #7126 · RustPython/RustPython
📝 Walkthrough
Walkthrough
Adds a Python script to identify and flag redundant test patches in the codebase—test functions that solely invoke super().<test>() variants—and integrates this checker into the CI/CD pipeline via an automated lint step.
Changes
| Cohort / File(s) | Summary |
|---|---|
CI/CD Workflow Integration .github/workflows/ci.yaml |
Updated lint job name and added Python environment setup with a new step to execute the redundant test patch checker script. |
New Redundant Patch Detector scripts/check_redundant_patches.py |
New Python utility that parses test files, identifies test functions with no decorators, detects those matching super().() call patterns, and reports them as removable with file path, function name, and line number. Exits with non-zero status when matches are found. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- PR
#6089: Relates to Python test AST processing for unittest-style wrapper patches; while this PR flags removable super().() wrappers, that PR handles generation and application of such patterns.
Suggested reviewers
- youknowone
- reactive-firewall
Poem
🐰 A hop and a skip through AST nodes so fine,
We hunt redundant patches that simply align,
With super().() calls, oh what a sight!
The CI now checks them—removed overnight,
One rabbit's joy: cleaner code done right! ✨
🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Add CI step for checking redundant test patches' accurately describes the main change: adding a new CI workflow step (in .github/workflows/ci.yaml) that runs a script to check for redundant test patches. |
| Merge Conflict Detection | ✅ Passed | ✅ No merge conflicts detected when merging into main |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
No actionable comments were generated in the recent review. 🎉
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.