Skip to content

Add Roslyn Analyzer for Replacing string.Format with Interpolated Strings (ECS0004) #41

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

Merged
merged 13 commits into from
Aug 2, 2024

Conversation

rjmurillo
Copy link
Owner

@rjmurillo rjmurillo commented Aug 2, 2024

This pull request introduces a new Roslyn analyzer and code fix to enforce the use of interpolated strings instead of string.Format. This change addresses the recommendations outlined in Effective C#: 50 Specific Ways to Improve your C#.

Rule Details

Rule ID: ECS0004

Title: Replace string.Format with interpolated string

Category: Style

Description: This rule identifies instances of string.Format and suggests replacing them with C# interpolated strings for improved readability and reduced error potential.

@rjmurillo rjmurillo added documentation Improvements or additions to documentation enhancement New feature or request analyzers labels Aug 2, 2024
@rjmurillo rjmurillo changed the title Feature/item 4 Add Roslyn Analyzer for Replacing string.Format with Interpolated Strings (ECS0004) Aug 2, 2024
@rjmurillo rjmurillo added this to the v0.1.0 milestone Aug 2, 2024
@rjmurillo rjmurillo self-assigned this Aug 2, 2024
Copy link

codacy-production bot commented Aug 2, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+3.00% (target: -1.00%) 94.05%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (5da647e) 356 278 78.09%
Head commit (a9d8520) 439 (+83) 356 (+78) 81.09% (+3.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#41) 84 79 94.05%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines 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

@rjmurillo rjmurillo marked this pull request as ready for review August 2, 2024 21:05
@rjmurillo rjmurillo enabled auto-merge (squash) August 2, 2024 21:16
@rjmurillo rjmurillo linked an issue Aug 2, 2024 that may be closed by this pull request
@rjmurillo rjmurillo merged commit dc194bb into release/v0.1.0 Aug 2, 2024
9 of 10 checks passed
@rjmurillo rjmurillo deleted the feature/item-4 branch August 2, 2024 21:23
rjmurillo added a commit that referenced this pull request Aug 19, 2024
…trings (ECS0004) (#41)

This pull request introduces a new Roslyn analyzer and code fix to
enforce the use of interpolated strings instead of `string.Format`. This
change addresses the recommendations outlined in Effective C#: 50
Specific Ways to Improve your C#.

## Rule Details

### Rule ID: ECS0004
**Title:** Replace string.Format with interpolated string

**Category:** Style

**Description:** This rule identifies instances of `string.Format` and
suggests replacing them with C# interpolated strings for improved
readability and reduced error potential.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzers documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Item 4: Replace string.Format with Interpolated Strings
1 participant