qossmic / deptrac

Keep your architecture clean.
https://qossmic.github.io/deptrac
MIT License
2.6k stars 135 forks source link

Formatter "graphviz-dot" generating different files on same code base #1433

Open nboiko-nx opened 1 month ago

nboiko-nx commented 1 month ago

Hello I was trying to build a workflow that checks for changes in our projects architecture. My plan was to generate a .dot file locally once using the graphviz formatter command and then run the same command in our github pipeline and use the new file to compare it to the old one. If the files were different the developer would be reminded to generate a new dot file and a new image of our current architecture. However the dot file generated locally was always different to the one generated in the pipleline even when nothing changed in the code. After further investigation we found that the .dot files had the same content but the layers where sorted in a different order. We use the same docker image locally and in our pipeline, the only difference I found was the creation date of the files, because github checks out the repository freshly every time when running the pipeline. So my guess would be that deptrac reads the files in order of creation date? I know this is probably a niche issue, but would it make sense to have an alphabetic(?) sorting when generating the dot files to make sure the output is consistent with the same file base?

gennadigennadigennadi commented 1 month ago

I don't have the time to investigate, so a PR is welcome.

nboiko-nx commented 1 month ago

Seems to be a simple fix. I tested it in our pipeline and the generated files are now equal: PR: https://github.com/qossmic/deptrac-src/pull/64