Whitelist for Source Code Transformation#134
Merged
Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…mation Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…ation Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in assertion whitelist mode to the Light.GuardClauses.SourceCodeTransformation tool, using a Roslyn-based reachability analysis to include only selected assertions and their dependencies, and adds post-generation build validation of the generated source project.
Changes:
- Introduces
AssertionWhitelistoptions and a newSourceReachabilityAnalyzerto compute a conservative dependency closure in whitelist mode. - Updates
SourceFileMerger/Programto apply whitelist filtering, adjust parse options, load layered settings files, and run build validation after generation. - Adds test coverage for whitelist behavior and build validation, plus supporting solution/docs/config updates.
Reviewed changes
Copilot reviewed 16 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Code/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs | New Roslyn reachability analyzer to drive whitelist trimming. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs | Integrates whitelist reachability, netstandard parsing, and conditional-trivia stripping. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceFileMergeOptions.cs | Adds AssertionWhitelist to merge options. |
| Code/Light.GuardClauses.SourceCodeTransformation/settings.json | Commits default settings enabling whitelist with all assertions included. |
| Code/Light.GuardClauses.SourceCodeTransformation/Program.cs | Adds settings.local.json layering, default path fallback, and build validation invocation. |
| Code/Light.GuardClauses.SourceCodeTransformation/Light.GuardClauses.SourceCodeTransformation.csproj | Adds settings.local.json copy behavior and System.Collections.Immutable reference. |
| Code/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs | New helper to dotnet build the generated project next to the target file. |
| Code/Light.GuardClauses.SourceCodeTransformation/AssertionWhitelist.cs | New whitelist model with reflection-based entry mapping. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs | Adds whitelist-mode behavioral tests (pruning + dependency retention). |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/Light.GuardClauses.SourceCodeTransformation.Tests.csproj | Adds project reference to source transformation project. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs | Adds build-validation and end-to-end Program execution tests. |
| Code/Light.GuardClauses.AllProjects.sln | Removes old Plans solution folder entry. |
| Code/CLAUDE.md | Adds pointer to AGENTS.md. |
| Code/ai-plans/AGENTS.md | Adds plan-writing instructions for ai-plans folder. |
| Code/ai-plans/0121-must-have-minimum-length-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0120-must-have-maximum-length-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0119-must-contain-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0118-must-have-length-in-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0117-must-have-length-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0116-must-not-contain-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0114-must-not-be-default-or-empty-for-immutable-array.md | Adds AI plan document. |
| Code/ai-plans/0061-whitelist-for-source-transformation.md | Adds AI plan document that this PR implements. |
| Code/AGENTS.md | Adds root agent guidance file. |
| Code/.idea/.idea.Light.GuardClauses.AllProjects/.idea/indexLayout.xml | Adds Rider metadata (IDE config). |
| .gitignore | Stops ignoring committed settings.json; ignores settings.local.json. |
Files not reviewed (1)
- Code/.idea/.idea.Light.GuardClauses.AllProjects/.idea/indexLayout.xml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ved generic types Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
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.
SourceReachabilityAnalyzerchecks which other types need to be included when an assertion is chosen by the user.Closes #61