fix(tools): keep line comments from hiding export bodies in the conve… #2457

Closed
SwazNaj7 wants to merge 1 commit from upstream-pr/2457 into main
SwazNaj7 commented 2026-10-09 21:51:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SwazNaj7 on 2026-10-09T21:51:20Z.


What

Fix function_body in tools/check_conventions.py. The // comment pattern used re.S, so . also matched newlines. A line comment inside an exported function therefore made function_body return None, and the silent-stub and duplicate-export checks skipped that function. Line comments now stop at the end of the line.

Adds tools/tests/test_check_conventions.py covering function_body (own-line, trailing and block comments, comment markers inside strings, prototypes) and stub detection.

Tested

Windows, Python 3, tools/tests:

  • Without the fix: python -m unittest test_check_conventions fails 5 of 11 tests (the line-comment cases).
  • With the fix: all 11 pass.
  • Other tool test modules still pass.
  • python tools/check_conventions.py --base upstream/main reports no findings on this branch.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4806249771 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2457). Originally posted by [SwazNaj7](https://github.com/SwazNaj7) on 2026-10-09T21:51:20Z. --- ### What Fix `function_body` in `tools/check_conventions.py`. The `//` comment pattern used `re.S`, so `.` also matched newlines. A line comment inside an exported function therefore made `function_body` return `None`, and the silent-stub and duplicate-export checks skipped that function. Line comments now stop at the end of the line. Adds `tools/tests/test_check_conventions.py` covering `function_body` (own-line, trailing and block comments, comment markers inside strings, prototypes) and stub detection. ### Tested Windows, Python 3, `tools/tests`: - Without the fix: `python -m unittest test_check_conventions` fails 5 of 11 tests (the line-comment cases). - With the fix: all 11 pass. - Other tool test modules still pass. - `python tools/check_conventions.py --base upstream/main` reports no findings on this branch. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-09 22:03:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:03:09Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090003602 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2457#issuecomment-6090003602). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T22:03:09Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2457
No description provided.