hrzndhrn / recode

A linter with autocorrection and a refactoring tool.
MIT License
295 stars 15 forks source link

Support listing public unused functions #48

Closed scottming closed 1 year ago

scottming commented 1 year ago

Hi, @NickNeck I think I've made some progress.

My implementation of reference is the same as your suggestion, which is to merge debug_info and AST information, debug_info can find the renamed modules and also easily find the modules imported with use, but it doesn't give the exact number of lines, so in AST I'm mainly looking for the number of lines.

Also, I know that for this task of listing public unused functions, it may not be necessary to have exact references. Maybe DebugInfo.calls is enough.

But I think it makes sense to implement an exact reference API, which will be used in my next refactoring tool. If you think you need to keep the PR clean, then I'm happy to include this module in the next PR.

p.s: This PR is not completely finished, and I'm sending the Draft first so that more people can see it and hope I'm on the right track.

NickNeck commented 1 year ago

Thank you for this PR. Unfortunately I don't have much time right now but I will review this as soon as possible.

scottming commented 1 year ago

Seems like tracers is better for this feature, so, I close this pr.