Mechanize UI color token enforcement check
I maintainer di solito rispondono entro 1 giorno
@ArthurArthurArthur0817 ci sta già lavorando.
Dal 4/11/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start by reading scripts/test.sh and the project’s CSS token guidance to understand how checks are run and which token-definition blocks are exempt. Add the checker at scripts/check-css-tokens.py and cover it in tests/scripts/test_check_css_tokens.py; run the unit tests and bash scripts/test.sh. Done means hardcoded colors outside exempt blocks are reported with file and line, while permitted tokens, comments, and strings do not cause false positives.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Adds an automated CSS color token enforcement tool in scripts/check-css-tokens.py to mechanize stylesheet color rules and prevent interface styles from hardcoding literal color values (Hex/RGB/HSL).
Motivation & Context
As described in the "Strengthening skills: code checking and progressive review" section of subsequent contribution directions, project guidelines require UI colors to use CSS tokens (var(--...)) to maintain consistency across themes (light/dark modes). However, this rule is not yet mechanized and relies entirely on manual code reviews. This creates unnecessary review overhead and allows hardcoded colors—such as fixed hex values failing on light backgrounds—to slip into the codebase.
Changes
- Add checker script (
scripts/check-css-tokens.py):- Scans CSS files under
web/. - Excludes
:rootand theme-specific token definition blocks, then checks remaining CSS rules for hardcoded literal color values (#hex,rgb(),rgba(),hsl(), etc.). - Reports exact file paths, line numbers, and offending values upon detecting violations, exiting with a non-zero status code (
1).
- Scans CSS files under
- Integrate into local test gates:
- Adds the checker to
scripts/test.shso style rules are validated automatically during the test run.
- Adds the checker to
- Add test coverage (
tests/scripts/test_check_css_tokens.py):- Implements unit tests for the script covering valid
var(--...)usage, permitted comments/strings, and interception of prohibited literal color formats to ensure zero false positives and reliable detection.
- Implements unit tests for the script covering valid
Testing
- Script unit tests pass:
python3 -m unittest tests/scripts/test_check_css_tokens.py(orpytest tests/scripts/test_check_css_tokens.py). - Full local test suite passes with no regressions:
bash scripts/test.sh. - Intentionally introduced
#ff0000intoweb/styles.cssto verify that the script pinpoints the offending line and halts the build.
- Lingua principale
- Rust
- Stelle
- 223
- Fork
- 148
- Merge medio
- 1g 11h
- PR unite (30g)
- 224
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sysprog21/codetrial
-
Check C++ starter node comments against the C++ harnessForse già presa @bangyou0912 l’ha presa oggi. Aperta
sysprog21/codetrial#594 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Transcript tab does not scroll to new turnsForse già presa @henrylee1003 l’ha presa oggi. Aperta
sysprog21/codetrial#592 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Let candidates save and switch between named session setupsForse già presa @domin67 l’ha presa oggi. Aperta
sysprog21/codetrial#591 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Let the candidate choose the editor indentation widthForse già presa @princelu1009 l’ha presa oggi. Aperta
sysprog21/codetrial#589 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
sysprog21/codetrial#587 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sysprog21/codetrial
Issue simili
-
area/tools bug session-analysis
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
oracle/rust-oracledb#66 ·
-
p3 testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
respanai/respan-gateway#166 ·
I maintainer di solito rispondono entro 1 giorno
-
fixes
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
astral-sh/ruff#30076 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno