{:ok, str} = File.read(file)
{:ok, ast} = Code.string_to_quoted(str)
{_, list_of_functions} =
ast
|> Macro.prewalk(
[],
fn
{:if, _, _} = ast_fragment, acc ->
{ast_fragment, [:if | acc]}
{:cond, _, _} = ast_fragment, acc ->
{ast_fragment, [:cond | acc]}
{:unless, _, _} = ast_fragment, acc ->
{ast_fragment, [:unless | acc]}
ast_fragment, acc ->
{ast_fragment, acc}
end
)
list_of_functions |> Enum.count()