Sourcetrail icon indicating copy to clipboard operation
Sourcetrail copied to clipboard

Provide graphml export option

Open virtuald opened this issue 5 years ago • 3 comments
trafficstars

In my mind one of the key things (besides visualization) Sourcetrail provides is a useful graph structure for source code that can be used for various types of analysis, without having to go through the pain of writing a clang analyzer yourself. However, since sourcetrail doesn't have plugins (#1076), writing your own analysis tools is a bit of work, and may not let you use other kinds of graph analysis tooling.

I've started on making a graphml exporter at https://gist.github.com/virtuald/95ecfa5047671f008395f5781a359cc7 , but it seems that getGraphForNodeTypes and getGraphForAll don't actually seem to create a full in memory graph.

virtuald avatar Sep 22 '20 21:09 virtuald

Updated the gist, using the SqliteIndexStorage directly made this super easy. The graph is usable, but there's more one could do to it.

virtuald avatar Sep 22 '20 22:09 virtuald

What a great idea! I really would like to see that included in sourcetrail, as it allows to perform further, graph based architecture analysis. Please include this feature in the next release of sourcetrail!

mrkdev avatar Oct 23 '20 08:10 mrkdev

I could imaging this to be availabe via a command line call. The current API looks like this:

$ Sourcetrail.exe -h
Usage:
  Sourcetrail [command] [option...] [positional arguments]

Commands:
  config                 Change preferences relevant to project indexing.*
  index                  Index a certain project.*

  * has its own --help

Options:
  -h [ --help ]          Print this help message
  -v [ --version ]       Version of Sourcetrail
  --project-file arg     Open Sourcetrail with this project (.srctrlprj)

Positional Arguments:
  1: project-file

For this feature I could imaging an export-graphml command that also requires the --project-file option to know for which project the graphml shall be exported. If anyone wants to implement this, please go ahead!

mlangkabel avatar Nov 18 '20 13:11 mlangkabel