Suggestion: string.Format without arguments
Open
Area-Analyzers
Feature Request
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 294
- Avg merge
- 2h 30m
- Merged PRs (30d)
- 4
Description
Since the `string.Format` method allows for an arbitrary number of format arguments it also accepts 0. However in case one provides zero arguments this is likely a mistake:
string.Format("some-text here")
->
"some-text here"
The code is not really identical, so I'm not sure if it's generally useful.
For example `string.Format` removes double curly braces `string.Format("{{0}}") == "{0}"` and throws on *any* placeholder `string.Format("{0}") == new FormatException`, but in most cases a `string.Format` without arguments is likely an oversight or a downright bug.
Contributor guide
Assessment
This issue has not been assessed yet.