3

In my GlobalSuppression.cs I often end up with long justifications. I want those to span multiple lines, but don't want to gloabally suppress SA1118. Ideally it would be something like this:

[module: SuppressMessage(
    "Microsoft.Design",
    "CA1056:UriPropertiesShouldNotBeStrings",
    Justification = @"
        A really long multi-line
        justification for suppressing 
        this.")]

[module: SuppressMessage(
    "StyleCop.CSharp.ReadabilityRules",
    "SA1118:ParameterMustNotSpanMultipleLines",
    Justification = "Justifications can get long.",
    Scope = "type",
    Target = "GlobalSuppression")]

But that doesn't seem to work. If I take off the Scope and Target it does.

On a side note, the syntax for Target is really cryptic. I would love to find a reference or some instructions on how to generate proper Target strings by hand (i don't use Visual Studio).

Lucas
  • 14,227
  • 9
  • 74
  • 124
  • Did you ever find a resource for this: "I would love to find a reference or some instructions on how to generate proper Target strings by hand"? – Eight-Bit Guru Jun 22 '20 at 16:44
  • @Eight-BitGuru, sadly, no. We have started to aggregate many examples internally by simply searching Github for `GlobalSuppression.cs` and reading existing from big projects (like dotnet itself). But this specific case still eludes me. – Lucas Jun 22 '20 at 16:58

0 Answers0