Mechanize UI color token enforcement check
维护者通常 1 天内回复
@ArthurArthurArthur0817 已经在做这个了。
开始于 2026年11月4日。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Rust
- 星标
- 223
- 派生
- 148
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 224
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
Check C++ starter node comments against the C++ harness可能已有人在做 @bangyou0912 今天认领。 未关闭
sysprog21/codetrial#594 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Transcript tab does not scroll to new turns可能已有人在做 @henrylee1003 今天认领。 未关闭
sysprog21/codetrial#592 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Let candidates save and switch between named session setups可能已有人在做 @domin67 今天认领。 未关闭
sysprog21/codetrial#591 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Let the candidate choose the editor indentation width可能已有人在做 @princelu1009 今天认领。 未关闭
sysprog21/codetrial#589 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
sysprog21/codetrial#587 · 4 条评论 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
apache/datafusion-iceberg#100 ·
维护者通常 1 天内回复
-
[Bug]: cua-driver skill fails Agent Skills frontmatter validation可能已有人在做 @Mearman 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
area/tools bug session-analysis
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
oracle/rust-oracledb#66 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复