@@ -52,7 +52,7 @@ defmodule Gradient.ElixirChecker do
5252 |> Stream . filter ( & is_fun_or_spec? / 1 )
5353 |> Stream . map ( & simplify_form / 1 )
5454 |> Stream . concat ( )
55- |> Stream . filter ( & has_line / 1 )
55+ |> Stream . filter ( & is_not_generated? / 1 )
5656 |> Enum . sort ( & ( elem ( & 1 , 2 ) < elem ( & 2 , 2 ) ) )
5757 |> Enum . reduce ( { nil , [ ] } , fn
5858 { :fun , fna , _ } = fun , { { :spec , { n , a } = sna , anno } , errors } when fna != sna ->
@@ -70,8 +70,11 @@ defmodule Gradient.ElixirChecker do
7070 |> Enum . map ( & { file , & 1 } )
7171 end
7272
73- # Filter out __info__ generated function
74- def has_line ( form ) , do: :erl_anno . line ( elem ( form , 2 ) ) > 1
73+ # Filter out __info__ and other generated functions with the same name pattern
74+ def is_not_generated? ( { _ , { name , _ } , _ } ) do
75+ name_str = Atom . to_string ( name )
76+ not ( String . starts_with? ( name_str , "__" ) and String . ends_with? ( name_str , "__" ) )
77+ end
7578
7679 def is_fun_or_spec? ( { :attribute , _ , :spec , _ } ) , do: true
7780 def is_fun_or_spec? ( { :function , _ , _ , _ , _ } ) , do: true
0 commit comments