Skip to content

Whitelist for Source Code Transformation#134

Merged
feO2x merged 10 commits into
devfrom
61-whitelist-for-source-transformation
Jul 1, 2026
Merged

Whitelist for Source Code Transformation#134
feO2x merged 10 commits into
devfrom
61-whitelist-for-source-transformation

Conversation

@feO2x

@feO2x feO2x commented Jul 1, 2026

Copy link
Copy Markdown
Owner
  • introduces a whitelist option for the Source Transformation project
  • the SourceReachabilityAnalyzer checks which other types need to be included when an assertion is chosen by the user.
  • the SourceCodeTransformation project now tries to compile the Source project for validation

Closes #61

feO2x added 5 commits June 30, 2026 20:57
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>
@feO2x feO2x requested a review from Copilot July 1, 2026 06:54
@feO2x feO2x self-assigned this Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AssertionWhitelist options and a new SourceReachabilityAnalyzer to compute a conservative dependency closure in whitelist mode.
  • Updates SourceFileMerger / Program to 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.

Comment thread Code/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs Outdated
Comment thread Code/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs Outdated
Comment thread Code/ai-plans/AGENTS.md Outdated
feO2x and others added 5 commits July 1, 2026 20:08
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>
@feO2x feO2x merged commit 27c6e95 into dev Jul 1, 2026
1 check passed
@feO2x feO2x deleted the 61-whitelist-for-source-transformation branch July 1, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add possibility to filter assertions using an allowed list / disallowed list when creating a custom single-source-code file

2 participants