Просмотр исходного кода

Make dialyzer warn about use of unknown types; fix some occurences of such

Sergey Prokhorov 4 лет назад
Родитель
Сommit
919f83b29a
4 измененных файлов с 19 добавлено и 8 удалено
  1. 2 3
      .travis.yml
  2. 1 1
      README.md
  3. 6 0
      rebar.config
  4. 10 4
      src/epgsql.erl

+ 2 - 3
.travis.yml

@@ -11,13 +11,12 @@ install: "true"
 language: erlang
 matrix:
   include:
-    - otp_release: 23.0
-    - otp_release: 22.2
+    - otp_release: 23.3.1
+    - otp_release: 22.3
     - otp_release: 21.3
     - otp_release: 20.3
     - otp_release: 19.3
     - otp_release: 18.3
-      dist: trusty
 script:
   - '[ "$TRAVIS_OTP_RELEASE" = "18.3" ] || make elvis' # TODO: remove the guard when OTP18 support is dropped
   - make test

+ 1 - 1
README.md

@@ -72,7 +72,7 @@ connect(Opts) -> {ok, Connection :: epgsql:connection()} | {error, Reason :: epg
       database => iodata(),
       port =>     inet:port_number(),
       ssl =>      boolean() | required,
-      ssl_opts => [ssl:ssl_option()],    % @see OTP ssl app, ssl_api.hrl
+      ssl_opts => [ssl:tls_client_option()], % @see OTP ssl documentation
       tcp_opts => [gen_tcp:option()],    % @see OTP gen_tcp module documentation
       timeout =>  timeout(),             % socket connect timeout, default: 5000 ms
       async =>    pid() | atom(),        % process to receive LISTEN/NOTIFY msgs

+ 6 - 0
rebar.config

@@ -32,3 +32,9 @@
          ]}
   ]
  }.
+
+{dialyzer,
+ [
+  {warnings, [unknown]},
+  {plt_apps, all_deps}
+ ]}.

+ 10 - 4
src/epgsql.erl

@@ -50,6 +50,12 @@
 
 -include("epgsql.hrl").
 
+-ifdef(OTP_RELEASE).
+-type ssl_options() :: [ssl:tls_client_option()].
+-else.
+-type ssl_options() :: list().
+-endif.
+
 -type sql_query() :: iodata(). % SQL query text
 -type host() :: inet:ip_address() | inet:hostname().
 -type password() :: string() | iodata() | fun( () -> iodata() ).
@@ -61,9 +67,9 @@
     {database, DBName     :: string()}             |
     {port,     PortNum    :: inet:port_number()}   |
     {ssl,      IsEnabled  :: boolean() | required} |
-    {ssl_opts, SslOptions :: [ssl:ssl_option()]}   | % see OTP ssl app, ssl_api.hrl
-    {tcp_opts, TcpOptions :: [gen_tcp:option()]}   | % see OTP ssl app, ssl_api.hrl
-    {timeout,  TimeoutMs  :: timeout()}            | % default: 5000 ms
+    {ssl_opts, SslOptions :: ssl_options()}        | % see OTP ssl app documentation
+    {tcp_opts, TcpOptions :: [gen_tcp:option()]}   | % see OTP gen_tcp module documentation
+    {timeout,  TimeoutMs  :: timeout()}            | % connect timeout, default: 5000 ms
     {async,    Receiver   :: pid() | atom()}       | % process to receive LISTEN/NOTIFY msgs
     {codecs,   Codecs     :: [{epgsql_codec:codec_mod(), any()}]} |
     {nulls,    Nulls      :: [any(), ...]} |    % terms to be used as NULL
@@ -78,7 +84,7 @@
           database => string(),
           port => inet:port_number(),
           ssl => boolean() | required,
-          ssl_opts => [ssl:ssl_option()],
+          ssl_opts => ssl_options(),
           tcp_opts => [gen_tcp:option()],
           timeout => timeout(),
           async => pid() | atom(),