Current section

Files

Jump to
cleam src cleam.erl
Raw

src/cleam.erl

-module(cleam).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([main/0]).
-file("/Users/darky/Projects/cleam/src/cleam.gleam", 31).
-spec print_not_used(
list({internal@ast:public_member(), internal@fs:file_path()})
) -> nil.
print_not_used(Not_used) ->
gleam@list:each(
Not_used,
fun(Not_used@1) ->
{Pub_member, {file_path, File_path}} = Not_used@1,
{Prefix, Name@3} = case Pub_member of
{public_fun, Name} ->
{<<"Function"/utf8>>, Name};
{public_const, Name@1} ->
{<<"Const"/utf8>>, Name@1};
{public_type, Name@2} ->
{<<"Type"/utf8>>, Name@2}
end,
gleam_stdlib:println_error(
<<<<<<<<Prefix/binary, " not used: "/utf8>>/binary,
Name@3/binary>>/binary,
"; File path: "/utf8>>/binary,
File_path/binary>>
)
end
).
-file("/Users/darky/Projects/cleam/src/cleam.gleam", 8).
-spec main() -> nil.
main() ->
Ast_info = internal@ast:files_paths_with_ast(
{files_dir, <<"src"/utf8>>},
{some, {files_dir, <<"test"/utf8>>}}
),
Not_used_fun = internal@checker:not_used_functions(
{files_dir, <<"src"/utf8>>},
Ast_info
),
print_not_used(Not_used_fun),
Not_used_const = internal@checker:not_used_const(
{files_dir, <<"src"/utf8>>},
Ast_info
),
print_not_used(Not_used_const),
Not_used_types = internal@checker:not_used_types(
{files_dir, <<"src"/utf8>>},
Ast_info
),
print_not_used(Not_used_types),
case ((erlang:length(Not_used_fun) > 0) orelse (erlang:length(
Not_used_const
)
> 0))
orelse (erlang:length(Not_used_types) > 0) of
true ->
erlang:halt(1);
false ->
erlang:halt(0)
end.