A one-character string is passed where an overload takes a char, such as IndexOf("x") or Split(",")
What it finds
The char overloads of IndexOf, LastIndexOf, StartsWith, EndsWith, Contains, Split and Replace compare ordinally and skip the string machinery; IndexOf(string) even compares by culture. A character literal says the same and runs faster.
From the rule's source, single_character_string_argument.rs.
class Paths{ int Dot(string name) => name.IndexOf(".");tx0 reports: IndexOf is given a one-character string where a char would do int Ext(string name) => name.IndexOf(".cs");} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:single-character-string-argument" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:single-character-string-argument] reason="..."tx0 explain tx0/csharp:single-character-string-argument shows the same in the terminal. Found a false positive? Report it.