Conversation
Refactor the sample websites to accept/fix code analyzer suggestions and use more modern C# syntax.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors sample websites to incorporate code analyzer suggestions and adopt modern C# syntax. Key changes include:
- Converting constructors to primary constructor syntax with property initializers.
- Replacing traditional method bodies with arrow expressions for brevity.
- Utilizing new collection initializer syntax (square bracket syntax) across controllers and other components.
Reviewed Changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/WebSites/CliExample/Startup.cs | Refactored to use primary constructor syntax with property initializer. |
| test/WebSites/CliExample/Program.cs | Converted Main() to arrow expression. |
| test/WebSites/CliExample/Controllers/ProductsController.cs | Updated array initialization to new C# syntax. |
| test/WebSites/Basic/Swagger/AddCartsByIdGetExternalDocs.cs | Added a trailing comma in object initializer to align with updated style. |
| test/WebSites/Basic/* | Various controllers adjusted with Debug.Assert statements and modern syntax refinements. |
| test/Swashbuckle.AspNetCore.IntegrationTests/* | Updated expected Swagger JSON snapshots with corrected documentation strings. |
| exclusion.dic | Updated exclusion list with new terms. |
Comments suppressed due to low confidence (2)
test/WebSites/Basic/Controllers/FromHeaderParamsController.cs:16
- The assertion for 'accept' references an undefined variable. Please remove or update it to check a valid header parameter.
Debug.Assert(accept is not null);
test/WebSites/Basic/Controllers/FromHeaderParamsController.cs:17
- The assertion for 'contentType' references an undefined variable. Please remove or update it to check a valid header parameter.
Debug.Assert(contentType is not null);
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #3450 +/- ##
=======================================
Coverage 93.55% 93.55%
=======================================
Files 110 110
Lines 3833 3833
Branches 715 715
=======================================
Hits 3586 3586
Misses 247 247
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Refactor the sample websites to accept/fix code analyzer suggestions and use more modern C# syntax.