(line: string, op: MeasurementOp)
| 82 | } |
| 83 | |
| 84 | export function findOperatorIndex(line: string, op: MeasurementOp): number { |
| 85 | // Match the operator only when surrounded by whitespace so that `<=` does |
| 86 | // not collide with `<` and a name like `lines<10` is not split. |
| 87 | let from = 0; |
| 88 | while (true) { |
| 89 | const idx = line.indexOf(op, from); |
| 90 | if (idx < 0) return -1; |
| 91 | const before = idx > 0 ? line[idx - 1] : " "; |
| 92 | const after = idx + op.length < line.length ? line[idx + op.length] : " "; |
| 93 | if (/\s/.test(before) && /\s/.test(after)) return idx; |
| 94 | from = idx + op.length; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | export interface MeasurementCheck { |
| 99 | name: string; |
no outgoing calls
no test coverage detected