gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
953 stars 33 forks source link

Add setting to fail 'tach check' if circular dependencies exist #146

Closed emdoyle closed 1 month ago

emdoyle commented 2 months ago

Some projects would like to ensure that their project's dependencies remain unidirectional, or in other words, that there are no cycles in their dependency graph.

A simple way to begin supporting this is to add a setting like forbid_circular_dependencies which can be set in tach.yml (ProjectConfig within the Tach codebase). When this setting is true, tach check should fail with a specific error message when a circular dependency is detected.

This should likely be done as a "pre-flight check" which would validate the modules list, and could be delegated to the ModuleTree internally. It does not need to apply any new logic to actual detected imports.

tiluckdave commented 1 month ago

Hey @emdoyle can I give this one a try next?

emdoyle commented 1 month ago

Absolutely!