Open andrewhongnsw opened 1 year ago
This is somewhat expected. We remove the method, but keep exterior trivia (leading and trailing). If there are comments there, or in your case #region
trivia, we want to keep it.
If we want to get fancy and start balancing the trivia ourselves, then we'd have to pick one set of rules to use. SA1507 doesn't like the multiline whitespace, but it is also feasible for a project to have the opposite and require two blank lines - or to require no blank lines at all.
SA1507 also includes a code fix, so you should be able to immediately fix up that secondary warning too.
The code fix to remove pointlessly overridden methods works as expected, except for cases where the overridden method comes immediately after, or comes immediately before a
#region
or#endregion
directive.In such cases, extra new lines are left in the returned document.
For example a code fix on the following snippet:
Will lead to:
This leads to
SA1507
errors on the lines between the#region
directive and the following method.