Skip to content

feat(repo-health): flexible license/readme detection and legacy packaging flags#9

Merged
JarbasAl merged 2 commits intodevfrom
feat/repo-health-improvements
Apr 15, 2026
Merged

feat(repo-health): flexible license/readme detection and legacy packaging flags#9
JarbasAl merged 2 commits intodevfrom
feat/repo-health-improvements

Conversation

@JarbasAl
Copy link
Copy Markdown
Member

@JarbasAl JarbasAl commented Apr 15, 2026

Summary

  • LICENSE variants: LICENSE, LICENSE.md, LICENSE.txt all satisfy the license check. Non-canonical names render as ✅ \LICENSE.md` — License file (consider renaming to `LICENSE`)`.
  • README variants: README.md, README.txt, README all satisfy the readme check. Same rename hint for non-canonical names.
  • Legacy packaging detection: when pyproject.toml is present, any co-existing setup.py, requirements.txt, or MANIFEST.in is flagged as 🗑️ legacy with a note — no CI failure, just advisory.
  • Bug fix: setup.py was previously added to results twice when both pyproject.toml and setup.py existed (once from SETUP_FILES loop, once from LEGACY_IF_PYPROJECT). It's now skipped in the SETUP_FILES loop when it will be reported as legacy. The corresponding hardcoded setup.py hide logic in the workflow formatter is removed.
  • Cleanup: removed dead REQUIRED_FILES = [] variable.

Test plan

  • Repo with LICENSE✅ \LICENSE` — License file`
  • Repo with LICENSE.md✅ \LICENSE.md` — License file (consider renaming to `LICENSE`)`
  • Repo with LICENSE.txt → same rename hint
  • Repo with no license file → ❌ \LICENSE` — License file`
  • Repo with pyproject.toml + setup.py + requirements.txt + MANIFEST.in → all three flagged as 🗑️ legacy, no failure
  • Repo with only setup.py (no pyproject.toml) → ✅ \setup.py``

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Repository health checks now provide rename suggestions for non-canonical file names
    • Enhanced visual indicators to flag legacy packaging files distinctly
  • Bug Fixes

    • Improved detection and reporting of setup files when modern alternatives are present
    • Fixed redundant reporting of optional files previously flagged as legacy

…ging flags

- Accept LICENSE, LICENSE.md, LICENSE.txt as valid license files; flag non-canonical names with rename suggestion
- Accept README.md, README.txt, README as valid readme files; flag non-canonical names with rename suggestion
- Detect pyproject.toml and flag setup.py, requirements.txt, MANIFEST.in as legacy (🗑️, no CI failure)
- Fix duplicate setup.py entry in results when both pyproject.toml and setup.py exist
- Remove dead REQUIRED_FILES list and hardcoded setup.py hide logic in formatter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 36 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 39 minutes and 36 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd7ad91b-5031-48e7-94df-f95c58c2d0e3

📥 Commits

Reviewing files that changed from the base of the PR and between 9775a55 and 59b4639.

📒 Files selected for processing (1)
  • scripts/check_opm.py
📝 Walkthrough

Walkthrough

The changes enhance repository health checking by introducing legacy file handling and canonical filename management. Legacy files now display with a trash icon and optional reason message, while the script identifies canonical filenames (README.md, LICENSE) and suggests renames for alternatives. The workflow icon logic shifts to flag unresolved optional items with warning indicators.

Changes

Cohort / File(s) Summary
Workflow Icon & Display Logic
.github/workflows/repo-health.yml
Updated PR health comment rendering to handle legacy items with 🗑️ icon and legacy_reason field; changed unresolved non-required item fallback from ℹ️ to ⚠️; added support for file rename suggestions appended to file lines; removed conditional suppression of setup.py when pyproject.toml exists.
Repository Health Check Script
scripts/check_repo_health.py
Enhanced check_required_files() to enforce canonical filenames (README.md, LICENSE) while accepting variants and recording rename_to suggestions; refactored setup-file logic to mark legacy packaging files with legacy: true and custom legacy_reason messages; modified optional files loop to skip requirements.txt when already flagged as legacy due to pyproject.toml presence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hopping through the repos with care,
We tidy up files here and there,
Legacy scripts in the trash go round,
While canonical names are now crowned,
Health checks dance with emoji flair!

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately and concisely summarizes the main changes: flexible detection of license/readme files with rename suggestions, and legacy packaging file flagging.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/repo-health-improvements

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/check_repo_health.py (1)

59-87: Add regression tests for rename_to and legacy report fields.

This change adds new output contract fields (rename_to, legacy, legacy_reason) but current tests in test/test_scripts.py do not assert them. Please add targeted checks so workflow rendering behavior is locked in.

Also applies to: 118-131

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/check_repo_health.py` around lines 59 - 87, Update the tests in
test/test_scripts.py to assert the new report fields added by
scripts/check_repo_health.py: verify that readme_entry and license_entry include
"rename_to" equal to README_CANONICAL and LICENSE_CANONICAL respectively when a
non-canonical file is found, and add assertions for any "legacy" and
"legacy_reason" fields where applicable (ensure the tests inspect the results
list entries created by readme_entry and license_entry and assert
existence/values of "rename_to", "legacy", and "legacy_reason" to lock the
output contract); ensure you reference the results entries produced by the
script (e.g., entries labeled "README" or "License file") so the assertions
remain robust if order changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/check_repo_health.py`:
- Around line 105-107: The check currently skips legacy files only when they
exist, so when pyproject.toml is present but setup.py is missing the script
still emits a warning; update the conditional to skip legacy filenames whenever
has_pyproject is true regardless of exists. Modify the block using
has_pyproject, filename, legacy_filenames, and exists so it reads something
like: if has_pyproject and filename in legacy_filenames: continue (i.e., remove
the exists requirement) so optional setup.py is suppressed when pyproject.toml
is present.

---

Nitpick comments:
In `@scripts/check_repo_health.py`:
- Around line 59-87: Update the tests in test/test_scripts.py to assert the new
report fields added by scripts/check_repo_health.py: verify that readme_entry
and license_entry include "rename_to" equal to README_CANONICAL and
LICENSE_CANONICAL respectively when a non-canonical file is found, and add
assertions for any "legacy" and "legacy_reason" fields where applicable (ensure
the tests inspect the results list entries created by readme_entry and
license_entry and assert existence/values of "rename_to", "legacy", and
"legacy_reason" to lock the output contract); ensure you reference the results
entries produced by the script (e.g., entries labeled "README" or "License
file") so the assertions remain robust if order changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 93e2f48c-8f6f-4037-84da-b9673be07869

📥 Commits

Reviewing files that changed from the base of the PR and between fa39846 and 9775a55.

📒 Files selected for processing (2)
  • .github/workflows/repo-health.yml
  • scripts/check_repo_health.py

Comment on lines +105 to +107
# skip setup.py here — it will be reported as legacy below
if has_pyproject and filename in legacy_filenames and exists:
continue
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Suppress setup.py warnings when pyproject.toml already exists.

At Line 106, setup.py is skipped only when it exists. If pyproject.toml exists and setup.py is absent, the script still emits a missing optional setup.py entry, which becomes a ⚠️ in the formatter. That conflicts with the “truly optional (no warning)” intent in this block.

Proposed fix
-        # skip setup.py here — it will be reported as legacy below
-        if has_pyproject and filename in legacy_filenames and exists:
+        # when pyproject.toml exists, do not report setup.py in setup group;
+        # if setup.py exists, it is reported below as legacy
+        if has_pyproject and filename == "setup.py":
             continue
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# skip setup.py here — it will be reported as legacy below
if has_pyproject and filename in legacy_filenames and exists:
continue
# when pyproject.toml exists, do not report setup.py in setup group;
# if setup.py exists, it is reported below as legacy
if has_pyproject and filename == "setup.py":
continue
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/check_repo_health.py` around lines 105 - 107, The check currently
skips legacy files only when they exist, so when pyproject.toml is present but
setup.py is missing the script still emits a warning; update the conditional to
skip legacy filenames whenever has_pyproject is true regardless of exists.
Modify the block using has_pyproject, filename, legacy_filenames, and exists so
it reads something like: if has_pyproject and filename in legacy_filenames:
continue (i.e., remove the exists requirement) so optional setup.py is
suppressed when pyproject.toml is present.

…M availability check

The entry point parsing block (import test + interface check) was gated
behind the ovos-plugin-manager import, so it never ran when OPM was absent
even though the import tests themselves have no OPM dependency. Moved the
block before the OPM import guard so import_ok is always populated when
test_import=True.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JarbasAl JarbasAl merged commit 95fb411 into dev Apr 15, 2026
6 checks passed
@JarbasAl JarbasAl deleted the feat/repo-health-improvements branch April 15, 2026 02:51
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.

1 participant