-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not warn SA1001 (Commas should be spaced correctly) if comma follows a preprocessor directive #3816
Comments
This is fine to fix. Can also likely work around: partial struct Money :
#if !NETSTANDARD
ISpanFormattable,
#endif
IFormattable Or: partial struct Money
#if NET6_OR_GREATER
: ISpanFormattable
#else
: IFormattable
#endif |
Good point, didn't think of that tbh. public readonly struct BigDecimal : IComparable<BigDecimal>, IEquatable<BigDecimal>, IComparable, IFormattable
#if NET7_0_OR_GREATER
#pragma warning disable SA1001 // Commas should be spaced correctly
, IFloatingPoint<BigDecimal>
#pragma warning restore SA1001
#endif After: public readonly struct BigDecimal :
#if NET7_0_OR_GREATER
IFloatingPoint<BigDecimal>,
#endif
IComparable<BigDecimal>, IEquatable<BigDecimal>, IComparable, IFormattable That works for me. |
Given that there is a suitable alternative form that avoids the warning, I'm fine with this being closed if you don't think it is needed. I prefer the suggested workaround anyway, the leading comma bothered me haha. |
I'm leaving this open because it's fairly standard for us to ignore the end-of-line/beginning-of-line rules in the presence of preprocessor directives. We could either ignore all directives here, or we could just ignore conditional directives ( |
Example where I don't think I should need to suppress the diagnostic:
The text was updated successfully, but these errors were encountered: