Skip to content

Commit a35a6cd

Browse files
committed
Merge pull request dotnet#99 from AndyGerlicher/header-location-78
Change CopyrightHeaderRule order to run later
2 parents 9c3dbbd + 7491aea commit a35a6cd

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/CombinationTest.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,38 @@ private void M()
330330

331331
Verify(source, expected, runFormatter: false);
332332
}
333+
334+
[Fact]
335+
public void CSharpHeaderCorrectAfterMovingUsings()
336+
{
337+
338+
var source = @"
339+
namespace Microsoft.Build.UnitTests
340+
{
341+
using System;
342+
using System.Reflection;
343+
344+
public class Test
345+
{
346+
public void RequiredRuntimeAttribute()
347+
{}
348+
}
349+
}";
350+
var expected = @"// header
351+
352+
using System;
353+
using System.Reflection;
354+
355+
namespace Microsoft.Build.UnitTests
356+
{
357+
public class Test
358+
{
359+
public void RequiredRuntimeAttribute()
360+
{ }
361+
}
362+
}";
363+
364+
Verify(source, expected);
365+
}
333366
}
334367
}

src/Microsoft.DotNet.CodeFormatting/Rules/RuleOrder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace Microsoft.DotNet.CodeFormatting.Rules
1313
internal static class SyntaxRuleOrder
1414
{
1515
public const int HasNoCustomCopyrightHeaderFormattingRule = 1;
16-
public const int CopyrightHeaderRule = 2;
17-
public const int UsingLocationFormattingRule = 3;
18-
public const int NewLineAboveFormattingRule = 4;
19-
public const int BraceNewLineRule = 6;
20-
public const int NonAsciiChractersAreEscapedInLiterals = 7;
16+
public const int UsingLocationFormattingRule = 2;
17+
public const int NewLineAboveFormattingRule = 3;
18+
public const int BraceNewLineRule = 4;
19+
public const int NonAsciiChractersAreEscapedInLiterals = 5;
20+
public const int CopyrightHeaderRule = 6;
2121
}
2222

2323
// Please keep these values sorted by number, not rule name.

0 commit comments

Comments
 (0)