You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OPL002 reports explicit string building in hot paths:
string.Concat(...), every overload (two or more strings or objects, the params form, and IEnumerable<string>), as string.Concat();
string.Format(...), every overload including those taking an IFormatProvider, as string.Format();
StringBuilder.ToString() and StringBuilder.ToString(int, int), as StringBuilder.ToString().
Reusing a StringBuilder avoids intermediate strings, but each ToString() still allocates the
result.
The implicit params array built for a string.Concat or string.Format call, and the boxing of
value-type arguments passed to one, are part of the call's allocation and are not reported again. a + b, which compiles to string.Concat, is still reported once as string concatenation.
5 tests, for 139 in total.
Changed
The OPL002 descriptor description, docs/rules/OPL002.md, the README and the
Unity package README list the new constructs.