Say I have a listing of all currencies:
public enum CurrencyType { /// <summary> /// United Arab Emirates dirham /// </summary> [EnumMember] AED = 784, /// <summary> /// Afghan afghani /// </summary> [EnumMember] AFN = 971, /// <summary> /// Albanian lek /// </summary> [EnumMember] ALL = 008, ... }
VS 2015 Code Analysis continues to complain of 100 CA1709 violations for each individual member.
This is a useful rule in itself, and I do not want to disable it; but in this particular case, it doesnโt help much, because CurrencyType is publicly available and is used in many other projects.
I can suppress the message; however, VS only offers to suppress it for each individual participant - this means that I will have 100 lines [SuppressMessage(...)] , which clutters the code.
Is there a way to suppress all CA1709 for all CurrencyType members without suppressing it for all other code in this project, without writing 100 [SuppressMessage(...)] ?
There is a Scope SuppressMessageAttribute parameter, but the documentation on it is unclear. I tried to post both
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Justification = "Currency codes are defined in ISO standard.")]
and
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Justification = "Currency codes are defined in ISO standard.")]
on CurrencyType . Does not work.