U0011 egui-status-glyph¶
Rule: A status glyph is painted in its tone, never written into a label.
| Code | U0011 (stable, never reused) |
| Id | egui-status-glyph |
| Category | egui |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | off | |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | deny |
a glyph in a label takes the text colour; ve_theme::status_icon paints it in its tone with a tooltip |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
calls |
list of strings | ["label", "button", "small_button", "heading", "selectable_label", "checkbox", "on_hover_text", "Label::new", "Button::new", "RichText::new"] |
calls that show text to a person |
glyphs |
list of strings | ["\u2705", "\U0001F6A7", "\U0001F9EA", "\U0001F41B", "\u26D4", "\u23F3", "\u274C", "\u26A0", "\U0001F7E2", "\U0001F7E1", "\U0001F534"] |
characters that carry a status |
replacement |
string | "ve_theme::status_icon" |
what paints a status glyph, named in the help |
toolkits |
list of strings | ["egui", "eframe", "iced", "slint", "gtk4", "relm4", "dioxus", "leptos", "yew", "floem", "xilem", "makepad-widgets"] |
UI toolkits: a crate that depends on one directly is a UI crate, unless the crate map says ui = false |
Why¶
A status glyph (done, blocked, failing) carries meaning. Written as a character inside a label, it takes the text colour and has no tooltip; the theme paints it in its tone with a tooltip that says what it means, so colour never carries the meaning alone.
The lint reports text of the calls in calls that holds one of glyphs.
ui.label(format!("{DONE} {name}")); // reported: DONE is the check-mark glyph
ve_theme::status_icon(ui, "done", "Built and tested"); // then the name beside it
How to fix¶
Paint the glyph with replacement (ve_theme::status_icon) beside the text.
Configure¶
[lints.egui-status-glyph]
level = "deny"
calls = ["label", "button", "small_button", "heading", "selectable_label", "checkbox", "on_hover_text", "Label::new", "Button::new", "RichText::new"]
glyphs = ["\u2705", "\U0001F6A7", "\U0001F9EA", "\U0001F41B", "\u26D4", "\u23F3", "\u274C", "\u26A0", "\U0001F7E2", "\U0001F7E1", "\U0001F534"]
replacement = "ve_theme::status_icon"
toolkits = ["egui", "eframe", "iced", "slint", "gtk4", "relm4", "dioxus", "leptos", "yew", "floem", "xilem", "makepad-widgets"]
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(egui-status-glyph) <reason> (waivers); the code works there too, as in [lints.U0011].