Skip to content

Commit

Permalink
Fix all remaining xref issues
Browse files Browse the repository at this point in the history
  • Loading branch information
filmor committed Oct 1, 2021
1 parent 9fc262e commit 4515172
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 23 deletions.
14 changes: 13 additions & 1 deletion apps/ierl/src/ierl_backend_elixir.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
-module(ierl_backend_elixir).

% Ignore all Elixir functions as xref has no way to find out about them
-ignore_xref([
{'Elixir.IEx.Autocomplete', expand, 1},
{'Elixir.Exception', format, 2},
{'Elixir.Exception', message, 1},
{'Elixir.Exception', normalize, 2},
{'Elixir.Kernel', inspect, 1},
{'Elixir.Code', string_to_quoted, 1},
{'Elixir.Code', 'string_to_quoted!', 1},
{'Elixir.Code', eval_string, 2}
]).

-behaviour(jup_kernel_backend).

-export([
Expand Down Expand Up @@ -32,7 +44,7 @@ opt_spec() ->
}.

language() ->
elixir.
<<"elixir">>.

init(Args) ->
case code:ensure_loaded(elixir) of
Expand Down
4 changes: 4 additions & 0 deletions apps/ierl/src/ierl_backend_erlang.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

-export([
init/1,
language/0,
deps/0,
opt_spec/0,

Expand All @@ -28,6 +29,9 @@ opt_spec() ->
[]
}.

language() ->
<<"erlang">>.

init(_Args) ->
#state{
bindings = erl_eval:new_bindings(),
Expand Down
2 changes: 1 addition & 1 deletion apps/ierl/src/ierl_backend_lfe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ opt_spec() ->
}.

language() ->
'common-lisp'.
<<"common-lisp">>.

init(_Args) ->
{ok, _} = application:ensure_all_started(lfe),
Expand Down
4 changes: 4 additions & 0 deletions apps/ierl/src/ierl_cmd.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-module(ierl_cmd).

-callback exec(_, _, _, _) -> _.
-callback opt_spec() -> _.
7 changes: 1 addition & 6 deletions apps/ierl/src/ierl_kernelspec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ create(Options) ->
Spec = #{
argv => Argv1,
display_name => jup_util:ensure_binary(DisplayName),
language => jup_util:call_if_exported(
BackendModule,
language,
[],
erlang
),
language => BackendModule:language(),
interrupt_mode => <<"message">>,
env => Env
},
Expand Down
16 changes: 8 additions & 8 deletions apps/ierl/src/ierl_util.erl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-module(ierl_util).

-export(
[
get_app_version/1,
simplify/1,
format_args/1,
find_span/2
]
).
% Not used right now, but may be again in the future
-ignore_xref([get_app_version/1]).
-export([
get_app_version/1,
simplify/1,
format_args/1,
find_span/2
]).

-spec get_app_version(atom()) -> string().
get_app_version(Name) ->
Expand Down
16 changes: 13 additions & 3 deletions apps/ierl/src/mochitemp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@
%% @doc Create temporary files and directories.

-module(mochitemp).
-export([gettempdir/0]).
-export([mkdtemp/0, mkdtemp/3]).
-export([rmtempdir/1]).

-ignore_xref([
gettempdir/0,
mkdtemp/0,
mkdtemp/3,
rmtempdir/1
]).
-export([
gettempdir/0,
mkdtemp/0,
mkdtemp/3,
rmtempdir/1
]).
%% -export([mkstemp/4]).
-define(SAFE_CHARS, {
$a,
Expand Down
2 changes: 1 addition & 1 deletion apps/jupyter/src/internal.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-define(JUPYTER_INTERNAL_HRL, 1).

-include_lib("kernel/include/logger.hrl").
-include("records.hrl").
-include("../include/records.hrl").

-record(jup_msg, {
uuids = [] :: [binary()],
Expand Down
5 changes: 4 additions & 1 deletion apps/jupyter/src/jup_kernel_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
}.

-callback init(Args :: map()) -> state().
-callback language() -> binary().
-callback deps() -> [module()].
-callback opt_spec() -> {Desc :: iodata(), [getopt:option_spec()]}.

-callback execute(Code :: binary(), jup_msg:type(), state()) ->
Expand Down Expand Up @@ -44,5 +46,6 @@
) -> {ok, jup_display:type()} | not_found.

-optional_callbacks([
opt_spec/0
opt_spec/0,
deps/0
]).
2 changes: 0 additions & 2 deletions apps/jupyter/src/jupyter.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
-module(jupyter).

-include("internal.hrl").

-ignore_xref([
start_kernel/4
]).
Expand Down

0 comments on commit 4515172

Please sign in to comment.