Skip to content

Commit

Permalink
Add docs (#35)
Browse files Browse the repository at this point in the history
* Add docs

* Typo

* Update priv/overview.edoc

Co-authored-by: Mackenzie <[email protected]>

* Update priv/overview.edoc

Co-authored-by: Pablo Costas Sánchez <[email protected]>

Co-authored-by: Mackenzie <[email protected]>
Co-authored-by: Pablo Costas Sánchez <[email protected]>
  • Loading branch information
3 people authored Jan 28, 2022
1 parent a77f331 commit caf0fb9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions priv/overview.edoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
** this is the overview.doc file for rebar3_hank **

@author Brujo <[email protected]>
@author Pablo <[email protected]>
@author Mackenzie <[email protected]>
@title Rebar3 Typer: Use TypEr directly from rebar3
@doc This project provides a rebar3 plugin that's a wrapper around TypEr so you can use the <code>rebar3 typer</code> as a command.
You can use it to annotate your functions with specs and types.

@reference See <a target="_blank" href="https://github.com/AdRoll/rebar3_typer">our README</a> for more information.
@reference See <a target="_blank" href="https://www.erlang.org/doc/man/typer.html">The Erlang Docs</a> to see what TypEr is capable of.
2 changes: 1 addition & 1 deletion src/rebar3_typer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%% =============================================================================
%% Public API
%% =============================================================================

%% @doc Main entry point for the plugin
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
{ok, State1} = rebar3_typer_prv:init(State),
Expand Down
4 changes: 3 additions & 1 deletion src/rebar3_typer_prv.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
%% =============================================================================
%% Public API
%% =============================================================================

%% @doc Set up the plugin.
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
Provider =
Expand All @@ -26,6 +26,7 @@ init(State) ->
{desc, "Execute TypEr on your code"}]),
{ok, rebar_state:add_provider(State, Provider)}.

%% @doc Run the plugin.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, {rebar3_typer_prv, term()}}.
do(State) ->
try
Expand All @@ -43,6 +44,7 @@ do(State) ->
{error, {?MODULE, {colliding_modes, NewMode, OldMode}}}
end.

%% @doc Turn errors into strings.
-spec format_error(any()) -> iolist().
format_error(not_implemented) ->
io_lib:format("Not yet implemented.", []);
Expand Down
1 change: 1 addition & 0 deletions src/typer_core.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

-type args() :: #args{}.

%% @doc Run TypEr with the provided options.
-spec run(opts()) -> ok.
run(Opts) ->
_ = io:setopts(standard_error, [{encoding, unicode}]),
Expand Down

0 comments on commit caf0fb9

Please sign in to comment.