Skip to content
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

Fix S2629 FP: Allow concatenation of constants #8891

Closed
hankovich opened this issue Mar 8, 2024 · 1 comment · Fixed by #8922
Closed

Fix S2629 FP: Allow concatenation of constants #8891

hankovich opened this issue Mar 8, 2024 · 1 comment · Fixed by #8922
Assignees
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@hankovich
Copy link

Description

S2629: Don't use string concatenation in logging message templates.

Repro steps

            Logger.LogError(e,
                "Cannot initialize storage, will retry in {Span}. " +
                "Executed {ExecutedCount} migrations of {TotalCount}. Failed on `{Name}`. Data: {Data}",
                RetryTimeSpan,
                index,
                migrationScripts.Count,
                migrationName,
                e.Data);

Expected behavior

No warnings are reported. Since I concatenate constant literals

Actual behavior

S2629 is reported.

Related information

  • C#/VB.NET Plugins version: 9.21.0.86780
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added Area: C# C# rules related issues. Sprint: Logging rules Type: False Positive Rule IS triggered when it shouldn't be. labels Mar 13, 2024
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added this to the 9.22 milestone Mar 13, 2024
@zsolt-kolbay-sonarsource
Copy link
Contributor

Thank you for reporting this. Confirmed as False Positive. I've added it to our current sprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants