From 6f66e26bf636b9db3721de1076de685b3b59c7f9 Mon Sep 17 00:00:00 2001 From: Boku Kihara Date: Sat, 25 May 2024 13:07:25 +0900 Subject: [PATCH 1/6] Updated rebar3_lint to 3.2.4 --- rebar.config | 2 +- src/aws_credentials.erl | 7 ++++--- src/aws_credentials_app.erl | 6 +++--- src/aws_credentials_httpc.erl | 5 +++-- src/aws_credentials_provider.erl | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rebar.config b/rebar.config index 7c17135..2cd96ec 100644 --- a/rebar.config +++ b/rebar.config @@ -40,4 +40,4 @@ , deprecated_functions ]}. -{plugins, [ {rebar3_lint, "0.3.2"} ]}. +{plugins, [ {rebar3_lint, "3.2.4"} ]}. diff --git a/src/aws_credentials.erl b/src/aws_credentials.erl index f11cc0a..ee2efed 100644 --- a/src/aws_credentials.erl +++ b/src/aws_credentials.erl @@ -41,7 +41,8 @@ , tref = undefined :: reference() | undefined }). --type state() :: #state{}. +-opaque state() :: #state{}. +-export_type([state/0]). % for linter only -type credentials() :: #{ credential_provider := aws_credentials_provider:provider() , access_key_id := access_key_id() @@ -128,9 +129,9 @@ terminate(_Reason, _State) -> -spec handle_call(any(), any(), state()) -> {'noreply', _} | {'reply', any(), state()}. -handle_call(get_credentials, _From, State=#state{credentials=C}) -> +handle_call(get_credentials, _From, #state{credentials=C}=State) -> {reply, C, State}; -handle_call({force_refresh, Options}, _From, State=#state{tref=T}) -> +handle_call({force_refresh, Options}, _From, #state{tref=T}=State) -> {ok, C, NewT} = fetch_credentials(Options), case is_reference(T) of true -> erlang:cancel_timer(T); diff --git a/src/aws_credentials_app.erl b/src/aws_credentials_app.erl index add4671..4aa78c7 100644 --- a/src/aws_credentials_app.erl +++ b/src/aws_credentials_app.erl @@ -11,9 +11,9 @@ %% API %%==================================================================== --spec start( 'normal' - | {takeover, Node :: node()} - | {failover, Node :: node()}, any()) -> {ok, pid()}. +-spec start('normal' + | {takeover, Node :: node()} + | {failover, Node :: node()}, any()) -> {ok, pid()}. start(_StartType, _StartArgs) -> aws_credentials_httpc:start(), aws_credentials_sup:start_link(). diff --git a/src/aws_credentials_httpc.erl b/src/aws_credentials_httpc.erl index b9e75e5..1451a74 100644 --- a/src/aws_credentials_httpc.erl +++ b/src/aws_credentials_httpc.erl @@ -32,7 +32,8 @@ -type headers() :: [header()]. -type response() :: {'error', response_error()} | {'ok', status_code(), body(), headers()}. --export_type([response/0, response_error/0, status_code/0, body/0, headers/0]). +-export_type([response/0, response_error/0, status_code/0, body/0, + headers/0, header/0, url/0, method/0]). -spec start() -> ok. @@ -58,7 +59,7 @@ request(Method, URL, RequestHeaders) -> %% successfully get the desired data. That is, it will return an %% ok tuple with a status code of 500 or 404 or some other HTTP error %% code and no data. --spec request(method(), url(), [header()], pos_integer() ) -> response(). +-spec request(method(), url(), [header()], pos_integer()) -> response(). request(Method, URL, RequestHeaders, Tries) when is_atom(Method) andalso is_list(URL) andalso is_integer(Tries) diff --git a/src/aws_credentials_provider.erl b/src/aws_credentials_provider.erl index 9ea7430..a3d95c9 100644 --- a/src/aws_credentials_provider.erl +++ b/src/aws_credentials_provider.erl @@ -38,7 +38,7 @@ | aws_credentials_ec2 | module(). -type error_log() :: [{provider(), term()}]. --export_type([ options/0, expiration/0, provider/0 ]). +-export_type([ options/0, expiration/0, provider/0, error_log/0 ]). -callback fetch(options()) -> {ok, aws_credentials:credentials(), expiration()} | {error, any()}. From 575d5b168810a06307d202807cf8d81c987c80a4 Mon Sep 17 00:00:00 2001 From: Boku Kihara Date: Sat, 25 May 2024 13:11:45 +0900 Subject: [PATCH 2/6] Fixed aws_credentials_httpc:start/1 type. --- src/aws_credentials_httpc.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aws_credentials_httpc.erl b/src/aws_credentials_httpc.erl index 1451a74..d41bb70 100644 --- a/src/aws_credentials_httpc.erl +++ b/src/aws_credentials_httpc.erl @@ -35,12 +35,12 @@ -export_type([response/0, response_error/0, status_code/0, body/0, headers/0, header/0, url/0, method/0]). --spec start() -> ok. - -include_lib("kernel/include/logger.hrl"). +-spec start() -> ok. start() -> - inets:start(httpc, [{profile, ?PROFILE}]). + _ = inets:start(httpc, [{profile, ?PROFILE}]), + ok. %% @doc Attempt to request a URL with the 3 retries. 3 is the default. -spec request(method(), url()) -> response(). From 227324cd4add025c631aaa0d3aa594aabe7a0682 Mon Sep 17 00:00:00 2001 From: Boku Kihara Date: Sat, 25 May 2024 13:45:51 +0900 Subject: [PATCH 3/6] Dropped OTP 22 and get rebar3_lint back to 3.0.1 for OTP 23 --- .github/workflows/build.yml | 2 +- rebar.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a32c32e..68b3ec0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest] - otp-version: [22, 23, 24, 25, 26] + otp-version: [23, 24, 25, 26] runs-on: ${{ matrix.platform }} container: image: erlang:${{ matrix.otp-version }} diff --git a/rebar.config b/rebar.config index 2cd96ec..30e7b88 100644 --- a/rebar.config +++ b/rebar.config @@ -40,4 +40,4 @@ , deprecated_functions ]}. -{plugins, [ {rebar3_lint, "3.2.4"} ]}. +{plugins, [ {rebar3_lint, "3.0.1"} ]}. From 6666c03f191e56d7aec14399b79557eab37d45eb Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 29 May 2024 08:39:15 +0200 Subject: [PATCH 4/6] Add OTP 27 to build versions --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68b3ec0..79c8c31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest] - otp-version: [23, 24, 25, 26] + otp-version: [23, 24, 25, 26, 27] runs-on: ${{ matrix.platform }} container: image: erlang:${{ matrix.otp-version }} From a7a855ec19fd42d65a96f0805588e24e9d345be9 Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 12 Jun 2024 17:36:59 +0200 Subject: [PATCH 5/6] Bump iso8601 to v1.3.4 --- rebar.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rebar.lock b/rebar.lock index d98d1f7..1ac268d 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,14 +1,14 @@ {"1.2.0", [{<<"eini">>,{pkg,<<"eini_beam">>,<<"2.2.4">>},0}, - {<<"iso8601">>,{pkg,<<"iso8601">>,<<"1.3.1">>},0}, + {<<"iso8601">>,{pkg,<<"iso8601">>,<<"1.3.4">>},0}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},0}]}. [ {pkg_hash,[ {<<"eini">>, <<"02143B1DCE4DDA4243248E7D9B3D8274B8D9F5A666445E3D868E2CCE79E4FF22">>}, - {<<"iso8601">>, <<"D1CEE73F56D71C35590C6B2DB2074873BF410BABAAB768F6EA566366D8CA4810">>}, + {<<"iso8601">>, <<"7B1F095F86F6CF65E1E5A77872E8E8BF69BD58D4C3A415B3F77D9CC9423ECBB9">>}, {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}]}, {pkg_hash_ext,[ {<<"eini">>, <<"12DE479D144B19E09BB92BA202A7EA716739929AFDF9DFF01AD802E2B1508471">>}, - {<<"iso8601">>, <<"A8B00594F4309A41D17BA4AEAB2B94DFE1F4BE99F263BC1F46DAC9002CE99A29">>}, + {<<"iso8601">>, <<"A334469C07F1C219326BC891A95F5EEC8EB12DD8071A3FFF56A7843CB20FAE34">>}, {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}]} ]. From d7433ba75f9ea9312f9ea664ee512859b521aaa5 Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 12 Jun 2024 17:39:10 +0200 Subject: [PATCH 6/6] Build docs on OTP 27 too --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79c8c31..7a20df9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest] - otp-version: [24, 25, 26] + otp-version: [24, 25, 26, 27] runs-on: ${{ matrix.platform }} container: image: erlang:${{ matrix.otp-version }} @@ -86,4 +86,4 @@ jobs: restore-keys: | ${{ runner.os }}-dialyzer- - name: Generate docs - run: rebar3 ex_doc \ No newline at end of file + run: rebar3 ex_doc