rjmurillo / EffectiveCSharp.Analyzers

Many of the recommendations in the book Effective C#: 50 Specific Ways to Improve Your C# can be validated by Roslyn-based analyzers and code fixes.
MIT License
2 stars 1 forks source link

Add ECS0005: prefer formattablestring for culture specific strings #49

Closed rjmurillo closed 2 months ago

rjmurillo commented 2 months ago

This pull request introduces a new Roslyn analyzer and associated code fix provider to enforce best practices for culture-specific string formatting in C#. The analyzer identifies cases where FormattableString or string.Create should be used instead of string for interpolated strings, depending on the target framework version. The code fix provider automatically suggests the appropriate replacement.

Changes

This analyzer aligns modern C# and .NET practices, particularly Stephen Toub's guidance on using string.Create in .NET 6+

codacy-production[bot] commented 2 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:x: -1.47% (target: -1.00%) :white_check_mark: 86.57%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (c5a55a18c852dca4b3263883e27a6c14be218100) | 595 | 548 | 92.10% | | | Head commit (c99180a5762cb5cdf644c024b304b8864044f8f9) | 811 (+216) | 735 (+187) | 90.63% (**-1.47%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#49) | 216 | 187 | **86.57%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more