feat: show override hygiene hint when overrides detected but --check-overrides not passed#760
Merged
Merged
Conversation
…kage.json Returns true if package.json at a given directory contains at least one entry in overrides (npm/Bun), pnpm.overrides, or resolutions (Yarn). Returns false if the file is missing, unreadable, or all containers are empty.
Import hasOverrideEntries and printOverrideHint into src/index.ts and call printOverrideHint after printFinalStatus (verbose) and after the renderOverrideFindings block (compact) when override entries are detected but --check-overrides and --ratchet are not active. Update jest.unstable_mockModule factories in cli-integration and multi-folder-printer tests to include printOverrideHint so ESM module linking does not fail on the new named import.
When running in multi-folder mode, print the override hygiene hint once if any subfolder has override entries and --check-overrides / --ratchet are not active. Mocks for hasOverrideEntries and printOverrideHint added to the multi-folder-scan test.
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.
When a project has override entries in
package.jsonbut--check-overrideswas not passed, the scan output now prints a single discovery tip at the end:Suppressed in
--json,--sarif,--cdx, and--ratchetmodes, and when--check-overrideswas already passed. No exit code impact, no network calls, no new CLI flags.What changed
src/utils/package-json.ts- newhasOverrideEntries(dir)utility: returns true if any ofoverrides,pnpm.overrides, orresolutionsis a non-empty objectsrc/output/printers.ts- newprintOverrideHint()functionsrc/index.ts- wired into both verbose and compact output pathssrc/scan/multi-folder-scan.ts- wired into multi-folder output (prints once even if multiple subfolders have overrides)Closes #759