feat: warn when ADR file scope is too broad#329
Merged
Conversation
Add a performance diagnostic to `resolveScopedFiles()` that warns users when an ADR's `files` glob resolves too many files (>1000) or takes too long (>2000ms). This helps users identify greedy glob patterns that slow down `archgate check`. Also updates ARCH-005 with a new Do/Don't about wrapping spyOn calls in try/finally to prevent spy leaks when assertions fail mid-test. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Deploying archgate-cli with
|
| Latest commit: |
339cd3e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2d24c8cc.archgate-cli.pages.dev |
| Branch Preview URL: | https://feat-greedy-glob-warning.archgate-cli.pages.dev |
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.
Summary
resolveScopedFiles()that emits alogWarn()when an ADR'sfilesglob resolves more than 1,000 files (SCOPE_FILE_WARN_THRESHOLD) or the glob scan takes longer than 2,000ms (SCOPE_SCAN_WARN_MS)filespatternsspyOncalls intry/finallyto prevent spy leaks when assertions failTest plan
bun run validatepasses (lint, typecheck, format, 1119 tests, 27/27 ADR checks, knip, build)archgate checkon a large repo with a broadfiles: ["**/*"]ADR to confirm warning appears