Mechanize UI color token enforcement check
Maintainer thường phản hồi trong vòng 1 ngày
@ArthurArthurArthur0817 đang làm issue này rồi.
Từ ngày 4/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 223
- Fork
- 148
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 227
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sysprog21/codetrial
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sysprog21/codetrial#604 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Compare code semantically across a force push in review bundlesCó thể đã có người làm @Alan52254 đã nhận hôm nay. Đang mở
sysprog21/codetrial#606 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Calculator % disagrees with // on negative operandsCó thể đã có người làm @YunJ-Chang đã nhận hôm nay. Đang mở
sysprog21/codetrial#602 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Start does nothing visible in the lobby when site data is blockedCó thể đã có người làm @sidney-Hung đã nhận hôm nay. Đang mở
sysprog21/codetrial#600 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add a Copy results action to the coding test panelCó thể đã có người làm @seallllllllll đã nhận hôm nay. Đang mở
sysprog21/codetrial#598 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sysprog21/codetrial
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
tauri-apps/tauri#16476 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fish-shell/fish-shell#13084 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug: merge_insert does not detect concurrent inserts of the same FixedSizeBinary primary keyCó thể đã có người làm @lance-gatefixer đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
lance-format/lance#10811 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
provider testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mishraprafful/multihull#234 ·
Maintainer thường phản hồi trong vòng 1 ngày