feat: add Codeberg/Gitea badge pattern support#9
Conversation
Expand badge validation to accept shields.io Gitea endpoints (stars, last-commit, license) and static/dynamic badges (language, license) used by Codeberg-hosted repos. Each badge type now accepts multiple alternative regex patterns — an entry passes if any matches.
📝 WalkthroughWalkthroughBadge pattern validation extended from single regex per type to multiple alternative regexes per type. The ChangesBadge pattern multi-format support
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1 1
Lines 152 153 +1
=======================================
+ Hits 151 152 +1
Misses 1 1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_lint.py (1)
431-533: ⚡ Quick winStrengthen positive badge tests by asserting zero lint errors.
These tests currently only check absence of one error message, so unrelated lint failures could slip through. For acceptance-path cases, assert
errors == []instead.Suggested update pattern
errors = lint_readme(readme, config) -assert not any("Missing required badge: stars" in e[1] for e in errors) +assert errors == []🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_lint.py` around lines 431 - 533, The tests that verify acceptance paths (e.g., test_codeberg_stars_badge_accepted, test_codeberg_last_commit_badge_accepted, test_codeberg_language_badge_accepted, test_codeberg_license_badge_accepted, test_codeberg_license_dynamic_json_accepted, test_github_badges_still_work) currently only assert absence of a specific "Missing required badge" message; replace those ad-hoc assertions with a strict equality check to ensure no lint errors at all by changing their final assertion to assert errors == [] (leave test_codeberg_all_badges_required_pass as-is).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/test_lint.py`:
- Around line 431-533: The tests that verify acceptance paths (e.g.,
test_codeberg_stars_badge_accepted, test_codeberg_last_commit_badge_accepted,
test_codeberg_language_badge_accepted, test_codeberg_license_badge_accepted,
test_codeberg_license_dynamic_json_accepted, test_github_badges_still_work)
currently only assert absence of a specific "Missing required badge" message;
replace those ad-hoc assertions with a strict equality check to ensure no lint
errors at all by changing their final assertion to assert errors == [] (leave
test_codeberg_all_badges_required_pass as-is).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 893943a6-2394-4b21-b0c1-5347fdbd93b2
📒 Files selected for processing (2)
lint.pytests/test_lint.py
Summary
BADGE_PATTERNSfrom single regex per badge type to a list of alternatives — an entry passes if any pattern matches/gitea/stars/,/gitea/last-commit/,/gitea/license/)shields.io/badge/patterns for language and license badgesTestCodebergBadgestest class with 8 new tests covering all badge typesThis enables awesome lists to include Codeberg-hosted repos with proper badge validation.
Test plan
Summary by CodeRabbit
Improvements
Tests