Fix the caps kicker to trigger on ratio, not uppercase count
All checks were successful
CI / check (push) Successful in 5m16s
All checks were successful
CI / check (push) Successful in 5m16s
This commit is contained in:
parent
e4a2e76903
commit
d0a86359c2
2 changed files with 15 additions and 1 deletions
|
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue