Skip to content

feat(tests): add multi-targeting and source generator improvements#274

Merged
j-d-ha merged 4 commits into
mainfrom
feature/update-generated-code-attribute
Dec 23, 2025
Merged

feat(tests): add multi-targeting and source generator improvements#274
j-d-ha merged 4 commits into
mainfrom
feature/update-generated-code-attribute

Conversation

@j-d-ha

@j-d-ha j-d-ha commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

🚀 Pull Request

📋 Summary

This PR introduces multi-targeting support for unit tests across .NET 8.0, 9.0, and 10.0, along with source generator and code quality improvements.

Key changes:

  • Multi-targeting support: Unit tests now target .NET 8.0, 9.0, and 10.0 frameworks
  • Source generator improvements: Replaced GeneratedCode attribute with fully qualified name to avoid namespace pollution
  • Code cleanup: Removed redundant null-forgiving operators, improved naming conventions, and simplified test code

✅ Checklist

  • My changes build cleanly
  • I've added/updated relevant tests
  • I've added/updated documentation or README
  • I've followed the coding style for this project
  • I've tested the changes locally (if applicable)

🧪 Related Issues or PRs

N/A - General improvements and modernization


💬 Notes for Reviewers

Multi-targeting changes:

  • GeneratorTestHelpers now includes conditional references based on target framework
  • Added [RequiresAssemblyFiles] attribute for reflection warnings
  • Integrated Basic.Reference.Assemblies for .NET 8.0 and 10.0 support
  • Updated Directory.Build.props for AOT compatibility in non-test projects

Source generator changes:

  • Changed [GeneratedCode] to [global::System.CodeDom.Compiler.GeneratedCode] in all generated code
  • This eliminates the need for using System.CodeDom.Compiler in generated files
  • All snapshot tests have been updated to reflect this change

Code quality improvements:

  • Removed unused test cases and redundant code
  • Improved variable naming (e.g., using _ for unused parameters)
  • Simplified async patterns where appropriate
  • Added appropriate warning suppressions for dynamic code analysis

- Removed redundant null-forgiving operators in test assertions.
- Updated parameter names to underscore (_) for unused variables.
- Renamed variables to adhere to standard naming conventions.
- Replaced async lambdas with direct task creation where applicable.
- Suppressed unused code warnings with proper comments.
- Simplified feature collection creation by reusing variables.
- Improved disposable enumerator usage with 'using' declaration.
- Deleted unused test cases to focus on relevance.
- Applied `pragma` to suppress dynamic code analysis warnings.
- Replaced out variable usage with discard (`_`) in test setups.
- Added missing ReSharper suppression comments.
…ully qualified name

- Updated `[GeneratedCode]` to use fully qualified `global::System.CodeDom.Compiler.GeneratedCode`.
- Removed redundant `using System.CodeDom.Compiler` directives from snapshots.
…in unit tests

- Updated `GeneratorTestHelpers` with conditional references based on target framework.
- Added `[RequiresAssemblyFiles]` attribute for reflection warnings on `GenerateFromSource`.
- Modified test project to target `net8.0`, `net9.0`, and `net10.0`.
- Integrated `Basic.Reference.Assemblies` for .NET 8.0 and 10.0.
- Updated `Directory.Build.props` for AOT compatibility in non-test projects.
- Removed unused references and project dependencies.
@github-actions github-actions Bot added the type: feat New feature label Dec 23, 2025
…ring literals

- Updated `LambdaHostOutputGenerator` to use raw string literals for `GeneratedCode` attribute.
- Simplified string formatting and improved readability.
@sonarqubecloud

sonarqubecloud Bot commented Dec 23, 2025

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@j-d-ha
j-d-ha merged commit 32419c4 into main Dec 23, 2025
6 checks passed
@j-d-ha
j-d-ha deleted the feature/update-generated-code-attribute branch December 23, 2025 03:00
@codecov

codecov Bot commented Dec 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #274      +/-   ##
==========================================
+ Coverage   88.92%   88.95%   +0.02%     
==========================================
  Files         132      132              
  Lines        3252     3251       -1     
  Branches      326      326              
==========================================
  Hits         2892     2892              
+ Misses        243      242       -1     
  Partials      117      117              
Files with missing lines Coverage Δ
...nerators/OutputGenerators/GenericHandlerSources.cs 96.36% <ø> (ø)
...tors/OutputGenerators/LambdaHostOutputGenerator.cs 100.00% <100.00%> (ø)
...ceGenerators/OutputGenerators/MapHandlerSources.cs 97.95% <ø> (ø)
...SyntaxProviders/Extractors/HandlerInfoExtractor.cs 80.55% <ø> (ø)
.../Builder/Extensions/ServiceCollectionExtensions.cs 100.00% <ø> (ø)
src/MinimalLambda/Builder/LambdaApplication.cs 97.50% <100.00%> (-0.12%) ⬇️
src/MinimalLambda/Builder/LambdaOnInitBuilder.cs 93.15% <100.00%> (+0.09%) ⬆️
src/MinimalLambda/Runtime/LambdaHandlerComposer.cs 95.74% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b06279...ba722f2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant