-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
dotnet/roslyn-analyzers
#6295Closed
Copy link
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Globalizationcode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixerpartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updated
Milestone
Description
We should write an analyzer that flags uses of IndexOf that's comparing the resulting index to 0, e.g.
https://grep.app/search?q=%5C.IndexOf%5C%28.%2A%3F%5C%29%20%3D%3D%200®exp=true&case=true&filter[lang][0]=C%23
Such use would be much better off with StartsWith, as IndexOf will search the entire string vs StartsWith which will only compare at the beginning.
pocki
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Globalizationcode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixerpartner-impactThis issue impacts a partner who needs to be kept updatedThis issue impacts a partner who needs to be kept updated