News for hackers. Stuff that matters.
Re:GitHub-Next by bern4444 on Friday August 26, 2022 @01:08PM (#32610124)
Regarding visualization of codebases, something I've wanted for a long time is a graph of function calls across an entire project.

I want to know all the callers and callees of every function. This shouldn't be too hard, we already have find references via LSP.

Turning this into a graph would make it significantly easier to manage the entry and exit points of a code base and inform architecture decisions, refactors, type checking, hot paths etc.

Re:GitHub-Next by jcparkyn on Friday August 26, 2022 @09:53PM (#32614810)
This isn't really what you're asking for, but since no-one else has mentioned it, the call hierarchy feature built into most IDEs gets about 50% of the way there. The obvious limitations are that this usually only works for one function at a time, and shows a tree not a graph.
Re:GitHub-Next by madelyn on Friday August 26, 2022 @02:21PM (#32610960)
I ended up doing this for our python codebases at work.

The AST module was super handy as you'd expect. The script would optionally take some filters to reduce the size of the generated graph, and then it sent all the info to Graphiz (it emitted DOT, too, so it could be version controlled!!)

It was extremely fun, highly recommended.

Re:GitHub-Next by 0x09 on Friday August 26, 2022 @04:03PM (#32612104)
Doxygen has the ability to generate these with its CALL_GRAPH/CALLER_GRAPH config, at least from each function individually. It can look quite funny when the depth isn't limited: https://i.imgur.com/3LMV71N.png
Re:GitHub-Next by cheald on Friday August 26, 2022 @06:00PM (#32613222)
It's coming at it from the wrong end, but I do a lot of this with kcachegrind, particularly for tracking down hot paths in Ruby, which is so dynamic that static analysis of nigh impossible. At least for the purposes of checking hot paths, it's quite useful.
Re:GitHub-Next by avg_dev on Friday August 26, 2022 @01:47PM (#32610610)
That’s a cool idea. I don’t know much about ASTs or anything but I know you are right about LSP being able to find most everything I am searching for in the mostly statically typed languages I’ve worked with. Would be fun to try that out over a weekend or three.
Re:GitHub-Next by kelsolaar on Friday August 26, 2022 @01:59PM (#32610725)
I have been looking for something like that for a while and your reply made me look again. I just came across Codemap (haven’t tried): https://codemap.app/
Re:GitHub-Next by bern4444 on Friday August 26, 2022 @02:21PM (#32610957)
Thanks for sharing! This looks pretty close to what I had in mind.