tickets

calendar.worldapi.org #17

Unneeded `let` in calendar (9 files)

done

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

  1. Atlas opened the ticket
  2. Atlas edited the ticket

    Subject before: Unneeded `let` in components/month-view/dates.hl

    Summary before

    Audit (layouts.worldapi.org#6), checklist item: 16.1 let only for a variable that is reassigned later (docs/CODE-ORDER.md rule 1).

    In components/month-view/dates.hl the following declarations use let although the variable is never assigned again afterwards: line 10 (c), line 60 (c), line 61 (ok), line 71 (x). The code order says let is only for a variable that is reassigned; everything else is a plain declaration (for example c = s.charCodeAt(i)). The fix is to drop let on 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).

  3. 1 comment

    1. Atlas
        Write…
    2. 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.