0
Fork 0
mirror of https://github.com/Droid-VM/DroidVM.git synced 2026-11-17 06:58:15 +00:00
Commit graph

2 commits

Author SHA1 Message Date
HuJK
efb636443f ci: three source checks, and a build that can unit-test a class that logs
check_arity.py walls off the constructors and methods that had grown past the
point where a caller can be read: a positional list long enough that swapping
two arguments of the same type still compiles. check_vector_icons.py holds the
drawables to one shape so an icon added in a hurry does not arrive at a
different optical size than the row it sits in. check_string_concat gets
stricter, and the two allow-lists carry the deliberate exceptions rather than
leaving the checks off.

isReturnDefaultValues lets a unit test cover a class that logs. Keeping every
testable class free of android.util.Log stopped being tenable once the classes
worth testing were the ones whose whole subject is a socket and a thread
outliving the object that owned them, and which say so out loud when they do.
Nothing asserts on a stub's return value; the stubs only let the class under
test be built.
2026-09-01 20:28:18 +08:00
HuJK
7595658e13 ci: enforce fmt() over complex string concatenation; convert existing ones
Add scripts/ci/check_string_concat.py (wired into the Checks workflow): a
Java-literal-aware scanner that fails when a bare + joins a string literal with a
runtime expression ("x=" + v), which reads better as fmt("x=%s", v). It masks
comments and string/char literals first, so + inside a literal ("wlan+", "%s+",
"\s+") and literal+literal constants are not flagged; a line can opt out with a
trailing // concat-ok comment.

A glance-obvious accumulator append stays as-is: a += statement with at most ONE
+ (s += "x" + y) reads clearly and is exempt; a += chaining two or more +
(s += "a" + b + "c") loses the exemption and is flagged. Only concatenation that
doesn't read at a glance is pushed to fmt(). The + count is scoped per statement
(to the next ; { }).

Convert the pre-existing complex concatenations across the codebase to fmt()
(mostly Log calls); route filesystem-path joins through pathJoin(). Simple
single-+ += appends are left as +=. StringUtils.pathJoin's own body keeps its +
with a // concat-ok note -- it is the canonical joiner and fmt() there would be
a hot-path cost.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaHcvnHaZk8qqpKiS25Hbk
2026-07-07 03:18:47 +08:00