Skip to content

Commit a264dfb

Browse files
committed
Use EditorConfig to apply file headers
- Use 'file_header_template' to specify our header text in EditorConfig so that the supported formatters can use it automatically when formatting files.
1 parent bdf9138 commit a264dfb

File tree

5 files changed

+10
-96
lines changed

5 files changed

+10
-96
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ insert_final_newline = true
4444
# C# files
4545
[*.cs]
4646

47+
#### File Header Template ####
48+
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information.
49+
4750
#### .NET Coding Conventions ####
4851

4952
# this. and Me. preferences
@@ -342,6 +345,9 @@ dotnet_diagnostic.CA2240.severity = warning
342345
dotnet_diagnostic.CA2241.severity = warning
343346
dotnet_diagnostic.CA2242.severity = warning
344347

348+
# Require file header OR A source file contains a header that does not match the required text
349+
dotnet_diagnostic.IDE0073.severity = error
350+
345351
# StyleCop Code Analysis
346352

347353
# Closing parenthesis should be spaced correctly: "foo()!"

azure-pipelines.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ jobs:
4444
- script: nbgv cloud
4545
displayName: Set NBGV version
4646

47-
# Verify headers
48-
- pwsh: build/Update-Headers.ps1 -Verify
49-
displayName: Verify headers
50-
5147
# Restore solution
5248
- script: dotnet restore -p:Configuration=$(Build.Configuration)
5349
displayName: Restore solution

build/Community.Toolkit.Common.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
<PackageIconUrl>https://raw.githubusercontent.com/CommunityToolkit/dotnet/main/build/nuget.png</PackageIconUrl>
1515
</PropertyGroup>
1616

17+
<PropertyGroup>
18+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
19+
</PropertyGroup>
20+
1721
<PropertyGroup>
1822
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1923
<LangVersion>10.0</LangVersion>

build/Update-Headers.ps1

Lines changed: 0 additions & 89 deletions
This file was deleted.

build/header.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)