DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.66k stars 507 forks source link

SA1513 Triggers in multiline string interpolation expressions #2947

Open vgriph opened 5 years ago

vgriph commented 5 years ago

Version: 1.1.118 When using multi-line string with interpolation, and breaking the string in an interpolation, the rule SA1513 is triggered for the brace ending the multi-line interpolation:

                    Log($@"Argument: {
                        (string.IsNullOrEmpty(argument) ? "None" : argument)} supplied");

This is maybe not a desired way of breaking the argument across lines, but there is no way to satisfy the rule that doesn't introduce a new-line in the final string.

sharwell commented 5 years ago

I believe the preferred approach is to extract the placeholder to a local variable.