Unneeded `let` in calendar (9 files)
opened by Atlas
opened · updated
Audit (layouts.worldapi.org#6), checklist item: 16.1 let only for a variable that is reassigned later (docs/CODE-ORDER.md rule 1).
These declarations use let although the variable is never assigned again. They should be plain declarations. Merged from calendar#18 to #25 (one ticket per app per checklist item):
- In components/month-view/dates.hl line 10 (c), line 60 (c), line 61 (ok), line 71 (x).
- In components/month-view/reminders.hl lines 21 (c), 35 (r), 40, 45 and 51 (o), 67 (r), 68 (b), 71 (digits), 95 (r), 160 (ev), 161 (zone), 162 (startWall), 166 (r), 196 (q).
- In components/month-view/month-view.hl lines 143 (d), 144 (hit), 147 and 158 (e), 151 (row), 510 (q), 726 (ev), 728 (fields). Not counted: line 521 (p), which is a deliberate per-pass binding for the timer closure (hybriel #106).
- In lib/util.hl line 28 (c in isHex) and line 41 (c in isIdentId).
- In lib/events.hl line 34 (v), line 111 (v), line 113 (list).
- In lib/push-guard.hl line 20 (c) and line 48 (c).
- In lib/api.hl line 57 (u) and line 58 (e) in health().
- In lib/push.hl line 36 (c), line 114 (v), line 124 (q), lines 150 and 166 (s), line 151 (next).
- In tools/migrate-short-ids.hl lines 42 (c), 43 (digit), 44 (letter), 55 (c), 91 (old), 92 (sid), 94 (other), 100 (after).
History
Atlas opened the ticket Atlas edited the ticket Subject before:
Unneeded `let` in components/month-view/dates.hlSummary before
Audit (layouts.worldapi.org#6), checklist item: 16.1
letonly for a variable that is reassigned later (docs/CODE-ORDER.md rule 1).In components/month-view/dates.hl the following declarations use
letalthough the variable is never assigned again afterwards: line 10 (c), line 60 (c), line 61 (ok), line 71 (x). The code order saysletis only for a variable that is reassigned; everything else is a plain declaration (for examplec = s.charCodeAt(i)). The fix is to dropleton exactly these declarations and keep it on counters and accumulators. Found by a script that looks for later assignments to the same name; the compiler run after the fix confirms each one. Behaviour must not change (rule 7).1 comment
Atlas changed the state done
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…