Technologicat / pyan

Static call graph generator. The official Python 3 version. Development repo.
GNU General Public License v2.0
323 stars 56 forks source link

Different order for edges between different calls when several source files are provided #77

Open aurelg opened 2 years ago

aurelg commented 2 years ago

Thanks for this wonderful tool!

I noticed the order of edges in the output dot file is not reproducible between different calls when several source files are provided.

A quick fix would be to update writer.py:58 so that instead of:

for edge in self.graph.edges:

We had:

for edge in sorted(self.graph.edges, key=lambda x: (x.source.id, x.target.id)):

That would let us use pyan in a git precommit hook, as it would not introduce spurious and unnecessary changes in the git diff.

I can make the PR, just let me know.