-
Notifications
You must be signed in to change notification settings - Fork 0
CAT 019
unurgunite edited this page Jul 11, 2026
·
3 revisions
| Field | Value |
|---|---|
| Severity | warning |
| Confidence | high |
| Auto-fix | ✅ |
Regex.new in loop → constant — Creating a Regex inside a loop recompiles the pattern each time. Extract to a constant.
3.times { Regex.new("pattern").match(str) }PATTERN = /pattern/
3.times { PATTERN.match(str) }