Repository navigation
feat(architecture): --forbid FROM->TO architecture rules - #45
Merged
Merged
Conversation
Turns --architecture into an enforceable contract. Each repeatable rule is FROM->TO, where a side ending in / is a directory and any other side one exact file. Rules are checked on the per-file edges before --group-depth and --max-render, so a view choice cannot hide a violation. Violations are listed on stderr with weight and rule; the diagram is still written, then the run exits 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of turning codeshot's drift-guarded diagrams into enforceable architecture contracts: language-agnostic dependency rules for anything codegraph indexes.
--forbid 'FROM->TO', repeatable,--architectureonly. A side ending in/is a directory prefix; any other side is one exact file; a leading./is stripped.aggregateFileEdges, before--group-depthrollup and--max-render, so neither can hide a violation.--forbidoutside--architecture, is rejected before any codegraph work.Live run on this repo (
--limit 100):--forbid 'test/->render/'reportstest/run.js -> render/callgraph.js (weight 55)and exits 1;--forbid 'render/->test/'is silent.Local:
node test/run.js188 passed, 0 failed (fork codegraph), including an end-to-end fixture: exit 1 on a violation, the diagram is still written, an exact-file rule fires under--group-depth 1, and exit 0 when clean.