Fix the caps kicker to trigger on ratio, not uppercase count
All checks were successful
CI / check (push) Successful in 5m16s

This commit is contained in:
Jean Chevronnet 2026-07-19 18:52:26 +00:00
parent e4a2e76903
commit d0a86359c2
No known key found for this signature in database
2 changed files with 15 additions and 1 deletions

View file

@ -635,7 +635,9 @@ impl KickerSettings {
if text.chars().count() >= min {
let upper = text.chars().filter(|c| c.is_ascii_uppercase()).count() as u32;
let lower = text.chars().filter(|c| c.is_ascii_lowercase()).count() as u32;
if upper as usize >= min && upper + lower > 0 && upper * 100 / (upper + lower) >= percent {
// Length is already gated above; gate only on the caps ratio here
// (a prior `upper >= min` clause wrongly demanded min uppercase letters).
if upper + lower > 0 && upper * 100 / (upper + lower) >= percent {
return Some("Turn caps lock off!");
}
}