|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
-encoding More...
-encoding
fix-encoding.py -- normalise source files to pure 7-bit ASCII.
Replaces common non-ASCII Unicode characters with their ASCII equivalents
(em-dash -> --, smart quotes -> plain quotes, Greek mu -> u, etc.), and is the
detector behind the ``ascii`` CI gate and ``just quality::local::ascii``.
``--all`` is the gate mode and DERIVES its scope from ``git ls-files`` via
``lint_targets.first_party_paths()``. It used to be driven by a hardcoded root
list in two places -- ``gate_ascii`` and the legacy quality task both looped over
``src libs tests examples port scripts tools docs`` -- so the encoding policy
never saw the repo root, ``.github/``, ``cmake/``, ``coprocessor/``, ``infra/``
or the task-runner configuration. 106 files, including ``CLAUDE.md``, the file that *states* the
policy (#533). A derived scope puts a new top-level directory in the gate the
day it lands, with no list to remember.
Aggravating the old form: a path that does not exist used to produce a silent
0, because ``rglob`` over a missing directory yields nothing -- so renaming a
root would have turned the gate green rather than red. A missing target is now
a hard error, and ``--all`` carries a non-vacuity floor.
Usage:
python3 scripts/fix/fix-encoding.py --all # rewrite in place
python3 scripts/fix/fix-encoding.py --check --all # the gate mode
python3 scripts/fix/fix-encoding.py --check path/to/file_or_dir
python3 scripts/fix/fix-encoding.py --selftest # both directions
Exit 0 if clean, 1 when a non-ASCII character was found, 2 when the scan could
not be trusted (a missing target, a collapsed enumeration, a failed selftest).