voltone / x509

Elixir package for working with X.509 certificates, Certificate Signing Requests (CSRs), Certificate Revocation Lists (CRLs) and RSA/ECC key pairs
BSD 3-Clause "New" or "Revised" License
120 stars 28 forks source link

Change usages of single quotes to sigil ~c #70

Closed tomekowal closed 4 months ago

tomekowal commented 5 months ago

When using elixir 1.17.0-rc.0-otp-27 and erlang 27.0

compilation produces warnings:

Compiling 23 files (.ex)
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 239 │       |> Keyword.get(:password, '')
     │                                 ~
     │
     └─ lib/x509/private_key.ex:239:33

     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 310 │     {'DES-EDE3-CBC', :crypto.strong_rand_bytes(8)}
     │      ~
     │
     └─ lib/x509/private_key.ex:310:6

    warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
    │
 30 │     '#{date}#{time}Z'
    │     ~
    │
    └─ lib/x509/date_time.ex:30:5

    warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
    │
 43 │     '#{date}#{time}Z'
    │     ~
    │
    └─ lib/x509/date_time.ex:43:5

     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     │
 408 │                      ' \'()+,-./:=?'
     │                      ~
     │
     └─ lib/x509/rdn_sequence.ex:408:22

This is because https://github.com/elixir-lang/elixir/releases/tag/v1.17.0-rc.0

[Kernel] Single-quote charlists are deprecated, use ~c instead

I checked that the sigil ~c existed in Elixir 1.5 https://hexdocs.pm/elixir/1.5.0-rc.0/Kernel.html that is the minimal supported Elixir according to mix.exs in the repository.

The change fixes the issue in newest Elixir while being fully backward compatible.

voltone commented 4 months ago

Superseded by #73 and #74