-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Version Used: 4.3.0-2.final (same behaviour with 4.3.0-3, but not with 4.3.0-1)
After updating the c# 11 test project in StyleCop.Analyzers to use a new Roslyn version, three tests (all called TestCodeFixProviderWithAlternateIndentationAsync) failed due to different formatting behaviour when adding braces around code in if statements (using SyntaxFactory.Block).
See DotNetAnalyzers/StyleCopAnalyzers#3535 for updated code.
The call to SyntaxFactory.Block is made here: https://github.com/bjornhellander/StyleCopAnalyzers/blob/feature/sa1206-required/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/LayoutRules/SA1503CodeFixProvider.cs#L72
And here we set indentation size to 1 in the failing test cases: https://github.com/bjornhellander/StyleCopAnalyzers/blob/feature/sa1206-required/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier%602.cs#L120
The three tests fail in slightly different ways, but the fixed code seems to have indentation size 4, instead of the specified and expected 1:
using System.Diagnostics;
public class Foo
{
public void Bar(int i)
{
if (i == 0)
- {
- Debug.Assert(true);
- }
- }
+ {
+ Debug.Assert(true);
+ }
+ }
}