Skip to content

[StyleCleanUp] Use literals where appropriate (CA1802) #10725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Apr 7, 2025

I've prepared this PR but then just realized that #10382 needs to be done first to prevent havoc, so gonna draft this.

Fixes #10724

Description

Swaps use of static readonly fields for const where appropriate. This in some cases saves allocations.

Note that naming issues will be taken care of in a separate issue to reduce diffs.

Customer Impact

Decreased allocations, a bit of perf.

Regression

No.

Testing

Local build.

Risk

Low, just an analyzer fix. The only issue would be reflection-based changes that will no longer be possible but there's no point of supporting these anyways, we'd never move anywhere.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners April 7, 2025 16:02
@h3xds1nz h3xds1nz marked this pull request as draft April 7, 2025 16:02
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Apr 7, 2025
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.20563%. Comparing base (72af9a5) to head (4dab672).
Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10725         +/-   ##
===================================================
- Coverage   11.25778%   11.20563%   -0.05216%     
===================================================
  Files           3315        3313          -2     
  Lines         665229      665139         -90     
  Branches       74668       74668                 
===================================================
- Hits           74890       74533        -357     
- Misses        589035      589307        +272     
+ Partials        1304        1299          -5     
Flag Coverage Δ
Debug 11.20563% <100.00000%> (-0.05216%) ⬇️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions draft PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA1802: Use literals where appropriate
1 participant