Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hex.pm actions, dialyzer, revert plugins #15

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/hex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: |
rebar3 edoc_extensions
rebar3 edoc
rebar3 hex publish -r hexpm --yes
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Add the plugin to your rebar config:

For generate `doc` with new style, run:
```sh
$ rebar3 edoc_extensions
$ rebar3 edoc
```

<!-- Badges -->
Expand Down
8 changes: 4 additions & 4 deletions elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
[{elvis_style, no_if_expression, disable},
{elvis_style, function_naming_convention, disable},
{elvis_style, no_tabs, disable},
{elvis_style, dont_repeat_yourself, disable}]},
#{dirs => ["test/**"],
filter => "*.erl",
ruleset => erl_files},
{elvis_style, dont_repeat_yourself, disable},
{elvis_style, no_nested_try_catch, disable},
{elvis_style, atom_naming_convention, disable},
{elvis_style, no_spec_with_records, disable}]},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config},
Expand Down
9 changes: 6 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
{minimum_otp_vsn, "23"}.

{project_plugins,
[{rebar3_hex, "~> 6.11.7"}, {rebar3_format, "~> 1.0.1"}, {rebar3_lint, "~> 1.0.1"}]}.
[{rebar3_hex, "~> 6.11.7"},
{rebar3_format, "~> 1.0.1"},
{rebar3_lint, "~> 1.0.1"},
{rebar3_edoc_extensions, "~> 0.2.4"}]}.

%{rebar3_hank, "~> 1.2.2"}

%{dialyzer, [{warnings, [no_return, unmatched_returns, error_handling, underspecs]}]}.
{dialyzer, [{warnings, [no_return, unmatched_returns, error_handling, underspecs]}]}.

{xref_checks,
[deprecated_function_calls, exports_not_used, locals_not_used, undefined_function_calls]}.
Expand All @@ -39,7 +42,7 @@

{cover_opts, [verbose]}.

{alias, [{test, [compile, format]}]}.
{alias, [{test, [compile, dialyzer, format, lint, {ct, "--verbose"}, cover, edoc]}]}.

{format,
[{ignore, ["src/*wrapper.erl", "src/*export.erl"]},
Expand Down
1 change: 1 addition & 0 deletions src/rebar3_edoc_extensions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2022 Viacheslav Katsuba.
%%

Expand Down
1 change: 1 addition & 0 deletions src/rebar3_edoc_extensions.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2022 Viacheslav Katsuba.
%%

-define(BODY_CLASSES, "markdown-body language-erlang").
Expand Down
5 changes: 3 additions & 2 deletions src/rebar3_edoc_extensions_export.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2022 Viacheslav Katsuba.
%%

-module(rebar3_edoc_extensions_export).
Expand All @@ -15,14 +16,14 @@

-export(['#root#'/4, '#element#'/5, '#text#'/1]).

-spec '#xml-inheritance#'() -> list().
-spec '#xml-inheritance#'() -> [].
'#xml-inheritance#'() -> [].

-spec '#text#'(term()) -> term().
'#text#'(Text) ->
xmerl_html:'#text#'(Text).

-spec '#root#'(term(), term(), term(), term()) -> term().
-spec '#root#'(term(), term(), [], term()) -> term().
'#root#'(Data, Attrs, [], E) ->
xmerl_html:'#root#'(Data, Attrs, [], E).

Expand Down
11 changes: 6 additions & 5 deletions src/rebar3_edoc_extensions_wrapper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2022 Viacheslav Katsuba.
%%

-module(rebar3_edoc_extensions_wrapper).
Expand All @@ -18,7 +19,7 @@
module(Element, Options) ->
edoc_layout:module(Element, Options).

-spec overview(term(), term()) -> term().
-spec overview(term(), term()) -> [binary() | list()].
overview(Element, Options) ->
Overview = edoc_layout:overview(Element, Options),
patch_html(Overview).
Expand All @@ -27,7 +28,7 @@ overview(Element, Options) ->
type(Element) ->
edoc_layout:type(Element).

-spec run(list(), term()) -> list().
-spec run(#doclet_gen{}, tuple()) -> ok | no_return().
run(#doclet_gen{app = App} = Cmd, Ctxt) ->
ok = edoc_doclet:run(Cmd, Ctxt),
%% Ctxt is a #context{} record in Erlang 23 and #doclet_context{} in Erlang
Expand Down Expand Up @@ -69,7 +70,7 @@ patch_html(Html) ->
[{return, list}, ungreedy, dotall, global]),
Html4.

-spec add_toc(term(), list(), list()) -> list().
-spec add_toc(term(), binary(), list()) -> list().
add_toc(App, Html, Dir) ->
case generate_toc(Dir, App) of
undefined ->
Expand All @@ -82,7 +83,7 @@ add_toc(App, Html, Dir) ->
[{return, list}])
end.

-spec generate_toc(list(), term()) -> list().
-spec generate_toc([binary() | list()], term()) -> [binary() | list()] | undefined.
generate_toc(Dir, App) ->
case get_overview(Dir) of
undefined ->
Expand All @@ -95,7 +96,7 @@ generate_toc(Dir, App) ->
generate_toc1(Titles, 0, [], App)
end.

-spec generate_toc1(list(), integer(), list(), term()) -> list().
-spec generate_toc1([binary() | list()], integer(), list(), term()) -> [binary() | list()].
generate_toc1([Title | Rest], CurrentLevel, Result, App) ->
ReOpts = [{capture, all_but_first, list}],
{match, [Equals, Title1]} = re:run(Title, "^(=+) *(.*)", ReOpts),
Expand Down