Implement style check script and CI#2670
Conversation
Scans all of src/ at the PR merge ref and warns (non-blocking, inline
file/line annotations) on any HSD_JObj{Set,Clear}Flags[All] call passing
raw 0x10/0x10U/16 instead of JOBJ_HIDDEN. The scanner is comment- and
string-literal-aware and paren-walks calls, so wrapped/multi-line calls
are detected; since doldecomp#2670 sweeps the tree to zero, any finding is newly
introduced. The workflow only reads source text and never executes
PR-controlled code.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
937c247 to
d9abccf
Compare
|
|
d9abccf to
e97b985
Compare
Syntax-aware sweep of HSD_JObj{Set,Clear}Flags[All] call sites replacing
raw hidden-flag literals (0x10 / 0x10U / 16 / 16U) in the flag argument
with the named JOBJ_HIDDEN: 505 sites across 73 files. Composite masks
and other flag values are untouched.
All 1046 compiled objects verified byte-identical before and after the
change (per-object sha1); main.dol sha1 unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A small, extensible style checker for the source tree. Each check is
enabled by default and can be disabled with --no-<check> (mirroring
clang's -Wno- flags); --msg-style {std,actions} selects human-readable
or GitHub Actions annotation output (mirroring configure.py and mwcc).
The first check, jobj-flags, flags HSD_JObj{Set,Clear}Flags[All] calls
passing a raw hidden-flag literal instead of JOBJ_HIDDEN. The flag
argument is matched with a precompiled regex covering the integer forms
whose value is 16 (hex/decimal/octal, optional suffix); the call scanner
is comment- and string-aware and handles calls split across lines.
tools/test_check.py holds the fixtures (run: python3 tools/test_check.py).
The style-check workflow runs the tests, then the checker over src/ as
non-blocking inline warnings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e97b985 to
d1e7417
Compare
Move the single-file checker into a package: tools/check/main.py (the driver and checks) and tools/check/__init__.py, with per-check fixtures under tools/check/tests/. Both checks (jobj-flags, assert-macros) live in the module; each is enabled by default and disabled with --no-<check>. std output now mirrors melee-issues (tools/issues): a severity > category > [option] > file hierarchy and a final Issues: OK / Issues: N summary, with matching exit codes (0, 65 EX_DATAERR, 74 EX_IOERR). --msg-style actions still emits GitHub Actions annotations. Remove the style-check CI workflow; the checker is a development tool run on demand (python3 tools/check/main.py), not part of CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ribbanya
left a comment
There was a problem hiding this comment.
Did the CI check get lost?
|
Both checks are already in — Or maybe I misunderstood what you meant by "Remove the CI check, it's for development of the tool only." |
|
Oh I see, the bot interpreted "don't run the self-tests during CI" as "remove the source checks from CI." It should definitely be linting src on pull requests. Just not the unit tests. |
Ah gotchya - that was misunderstanding on both claude & I's part lol |
Run the checker over src on push and pull_request. Findings fail the job (exit 65) with inline annotations (--msg-style actions); an internal error fails it (74). The unit tests under tools/check/tests are a development tool and are intentionally not run in CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
okay should be good now? lmk if you want anything else adjusted |
|
It would be useful to also have a CLI option that applies the fixes (to be run locally), instead of relying on an LLM to interpret and implement them. But that can be done later, or never, up to you. |
5896c57 to
dcae43a
Compare
love that idea - im gonna be continuing to do some tooling improvements like this so will fold that in in some upcoming PRs. thanks for the help on this one |
Summary
Tooling for the style-check series. Both source sweeps merged separately (#2675 jobj
0x10→JOBJ_HIDDEN, #2676 assert macros), so this PR is tooling only.Adds
tools/check/— a small, extensible style checker:--no-<check>(mirrors clang-Wno-):jobj-flags(raw0x10whereJOBJ_HIDDENis meant) andassert-macros(direct__assertcalls expressible with the HSD assert macros;@todo-annotated sites exempt)--msg-style std(default) mirrorsmelee-issues(tools/issues): aseverity > category > [option] > filehierarchy and anIssues: OK/Issues: Nsummary, with the same exit codes (0 / 65EX_DATAERR/ 74EX_IOERR).--msg-style actionsemits GitHub Actions annotations.tools/check/tests/(run:python3 -m unittest discover -s tools/check/tests -t tools -p '*.py')CI (
style-check.yml) lintssrcon push and pull_request — findings fail the job with inline annotations, mirroringmelee-issues. The unit tests are a development tool and are not run in CI.Incorporates @ribbanya's review (module layout; opt-out per-check flags;
--msg-style;stdmirrorsmelee-issues+ exit codes; type annotations; line-break handling; precompiled regex; tests as a separate module; lint src in CI, not the unit tests).🤖 Generated with Claude Code