A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/SonarSource/sonar-dotnet/issues/5521 below:

should not apply when strings are not aggregated · Issue #5521 · SonarSource/sonar-dotnet · GitHub

Sonar version: Version 9.3 (build 51899)

I do not think rule S1643 (strings should not be concatenated using '+' in a loop) should be applied when the loop is not used to aggregate strings.

Consider this example:

class MyObject
{
    public string Name { get; set; }
    public bool Enabled { get; set; }
}

void MarkDisabled(IList<MyObject> objects)
{
    foreach (var obj in objects)
    {
        if (!obj.Enabled)
            obj.Name += " - DISABLED";
    }
}

This alters a string field of a specific object and does not aggregate the results.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4