Skip to content

Comments

Refactor sample websites#3450

Merged
martincostello merged 1 commit intomasterfrom
sample-refactor
Jun 7, 2025
Merged

Refactor sample websites#3450
martincostello merged 1 commit intomasterfrom
sample-refactor

Conversation

@martincostello
Copy link
Collaborator

Refactor the sample websites to accept/fix code analyzer suggestions and use more modern C# syntax.

Refactor the sample websites to accept/fix code analyzer suggestions and use more modern C# syntax.
Copilot AI review requested due to automatic review settings June 7, 2025 10:59
Copy link

Copilot AI left a comment

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 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
Copy link

codecov bot commented Jun 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.55%. Comparing base (b0381a5) to head (c69a9ab).
Report is 1 commits behind head on master.

✅ 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           
Flag Coverage Δ
Linux 93.55% <ø> (ø)
Windows 93.55% <ø> (ø)
macOS 93.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello enabled auto-merge (rebase) June 7, 2025 11:02
@martincostello martincostello merged commit 0ab2172 into master Jun 7, 2025
11 checks passed
@martincostello martincostello deleted the sample-refactor branch June 7, 2025 11:05
This was referenced Jul 28, 2025
This was referenced Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant