• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scrogson / oauth2 / 152 / 3
96%
master: 96%

Build:
DEFAULT BRANCH: master
Ran 30 Dec 2016 07:44PM UTC
Files 14
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Dec 2016 07:42PM UTC coverage: 92.179% (+1.1%) from 91.061%
152.3

push

travis-ci

scrogson
Fix dialyzer warning on @type params (#84)

Dialyzer complains about the `get_token/4` and `get_token!/4` functions, because the typespec says that the `params` argument is supposed to be a map with binary keys, whereas `OAuth2.Strategy.AuthCode.get_token/3` expects them to be a Keyword list.

Code:

```elixir
client()
|> OAuth2.Client.get_token!([code: code], [], [])
|> OAuth2.Client.get!("/user")
```

Dialyzer's complaint:

```
git_hub.ex:60: The call 'Elixir.OAuth2.Client':'get_token!'(#{'__struct__':='Elixir.OAuth2.Client', 'authorize_url':=binary(), 'client_id':=binary(), 'client_secret':=binary(), 'headers':=[{binary(),binary()}], 'params':=#{binary()=>binary() | [binary() | [any()] | map()] | #{binary()=>binary() | [any()] | map()}}, 'redirect_uri':=binary(), 'site':=binary(), 'strategy':=atom(), 'token':='nil' | #{'__struct__':='Elixir.OAuth2.AccessToken', 'access_token':=binary(), 'expires_at':=integer(), 'other_params':=#{}, 'refresh_token':=binary(), 'token_type':=binary()}, 'token_method':=atom(), 'token_url':=binary()},[{'code',_},...],[],[]) will never return since the success typing is (#{'__struct__':='Elixir.OAuth2.Client', 'authorize_url':=binary(), 'client_id':=binary(), 'client_secret':=binary(), 'headers':=[{binary(),binary()}], 'params':=#{binary()=>binary() | [binary() | [any()] | map()] | #{binary()=>binary() | [any()] | map()}}, 'redirect_uri':=binary(), 'site':=binary(), 'strategy':=atom(), 'token':='nil' | #{'__struct__':='Elixir.OAuth2.AccessToken', 'access_token':=binary(), 'expires_at':=integer(), 'other_params':=#{}, 'refresh_token':=binary(), 'token_type':=binary()}, 'token_method':=atom(), 'token_url':=binary()},#{binary()=>binary() | [binary() | [any()] | #{binary()=>_}] | #{binary()=>binary() | [any()] | #{binary()=>_}}},[{binary(),binary()}],[{atom(),_}]) -> #{'__struct__':='Elixir.OAuth2.Client', 'authorize_url':=binary(), 'client_id':=binary(), 'client_secret':=binary(), 'headers':=[], 'params':=#{}, 'redirect_uri':=binary(), 'site':=binary(), 'strategy':=atom(), 'token':=#{'__struct__':='Elixir.OAuth2.AccessToken', 'access_token':=binary(), 'expires_at':=integer(), 'other_params':=#{}, 'refresh_token':=binary(), 'token_type':=binary()}, 'token_method':=atom(), 'token_url':=binary()} and the contract is (t(),params(),headers(),'Elixir.Keyword':t()) -> 'Elixir.OAuth2.Client':t() | 'Elixir.OAuth2.Error':t()
```

If I change the code to make Dialyzer happy, it no longer functions:

```elixir
client()
|> OAuth2.Client.get_token!(%{"code" => code}, [], [])
|> OAuth2.Client.get!("/user")
```

However, with this typespec change, everything works fine.

165 of 179 relevant lines covered (92.18%)

10.14 hits per line

Source Files on job 152.3
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 152
  • Travis Job 152.3
  • 75c397e2 on github
  • Prev Job for on master (#150.3)
  • Next Job for on master (#154.3)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc