Formatted conditional expressions can contain style errors
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 173
- Avg merge
- 10d 13h
- Merged PRs (30d)
- 1
Description
Repository example: https://github.com/Arthri/TernaryTest
I have:
```cs
if (input == "Y")
{
response = "Success!";
}
else if (input == "N")
{
response = "Failed";
}
else
{
response = "Invalid response";
}
```
```ini
# Use conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true
```
when I run `dotnet format -w -s info -a info` it turns to:
```cs
if (input == "Y")
{
response = "Success!";
}
else
{
response = input == "N" ? "Failed" : "Invalid response";
}
```
which still contains some style errors
Is it possible to fix the style errors all at once? Anyways, thanks for the amazing tool! Though it's not an issue at the moment, I figured I'd just report it
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.