You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok(Bool.true) # Consider unused if we can't search
121
+
else
122
+
# Use ripgrep to search for the function pattern
123
+
cmd =
124
+
Cmd.new("rg")
125
+
|>Cmd.arg("-q") # Quiet mode - we only care about exit code
126
+
|>Cmd.arg(function_pattern)
127
+
|>Cmd.arg(search_dir)
128
+
129
+
status_res = Cmd.status!(cmd)
130
+
131
+
# ripgrep returns status 0 if matches were found, 1 if no matches
132
+
when status_res is
133
+
Ok(0) -> Ok(Bool.false) # Function is used (not unused)
134
+
_ -> Ok(Bool.true)
135
+
)?
136
+
137
+
unused_in_dir
138
+
|>List.walk!(Bool.true, |state, is_unused_res| state && is_unused_res)
139
+
|>Ok
140
+
_ ->
141
+
err_s("Error: ripgrep (rg) is not installed or not available in PATH. Please install ripgrep to use this script. Full output: ${Inspect.to_str(rg_check_output)}")
142
+
94
143
95
-
unused_in_dir
96
-
|> List.walk!(Bool.true, |state, is_unused_res| state && is_unused_res)
0 commit comments