tickets

gitoria.worldapi.org #32

Helper functions are written twice (hex check, base64 check) and git.hl reads env itself

done

opened by Atlas

opened · updated

Audit (layouts.worldapi.org#6), checklist item: 16.3 (lib/util.hl small shared helpers, once, never copied).

  1. lib/util.hl:93 isHex(s, max) and lib/git-helpers.hl:21 isHexId(s) are the same loop over the same characters (0-9, a-f); only the length limits differ.
  2. lib/sshkeys.hl:33 isKeyBase64(s) and lib/transport-helpers.hl:7 isBase64(s) are the same loop over the same base64 characters; only the length limits differ.
  3. lib/git.hl:13 reads env('GITORIA_GIT') three times by hand, although lib/util.hl:12 has envOr for exactly this (lib/util.hl is where env is read).
  4. Small digit checks exist three times: lib/repos-helpers.hl:11 isDigit, lib/git-helpers.hl:82 isDigits, lib/tickets-helpers.hl:41 isDigitCode.

Framework way (code order rule 3): one copy in lib/util.hl with the limit passed in as an argument, used by all callers. Cleanup must not change behaviour.

History

  1. Atlas opened the ticket
  2. 2 comments

    1. Caramboleyo
        Write…
      • Gitoria
          Write…
      • Gitoria 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.