Skip to content

Commit cc08eda

Browse files
committed
Add comments option
1 parent 7bed5cc commit cc08eda

File tree

11 files changed

+33
-3
lines changed

11 files changed

+33
-3
lines changed

Source/NuGetTemplate/.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,18 @@ dotnet_naming_rule.parameters_rule.severity = warning
418418
##########################################
419419

420420
[*.cs]
421+
#if (!Comments)
422+
# SA0001: XML comment analysis is disabled due to project configuration
423+
# Justification: Comments turned off
424+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md
425+
dotnet_diagnostic.SA0001.severity = none
426+
427+
# SA1600: Elements should be documented.
428+
# Justification: Comments turned off
429+
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1600.md
430+
dotnet_diagnostic.SA1600.severity = none
431+
432+
#endif
421433
# SA1633: A C# code file is missing a standard file header.
422434
# Justification: Comments turned off
423435
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md

Source/NuGetTemplate/.template.config/dotnetcli.host.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"ContactXmlEncoded": {
4141
"isHidden": true
4242
},
43+
"Comments": {
44+
"longName": "comments"
45+
},
4346
"ReadMe": {
4447
"longName": "readme"
4548
},

Source/NuGetTemplate/.template.config/template.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@
226226
"valueSource": "Contact",
227227
"valueTransform": "xmlEncode"
228228
},
229+
"Comments": {
230+
"type": "parameter",
231+
"datatype": "bool",
232+
"defaultValue": "true",
233+
"displayName": "Comments",
234+
"description": "Require comments on all code."
235+
},
229236
"ReadMe": {
230237
"type": "parameter",
231238
"datatype": "bool",

Source/NuGetTemplate/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
66
<DotnetFramework>false</DotnetFramework>
77
<EditorConfig>true</EditorConfig>
8+
<ImplicitUsings>true</ImplicitUsings>
89
<MIT>true</MIT>
910
<Nullable>true</Nullable>
1011
<StyleCop>true</StyleCop>

Source/NuGetTemplate/Source/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<PropertyGroup Label="Build">
1414
<IsTrimmable Condition="'$(IsTrimmable)' == 'true'">true</IsTrimmable>
15-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
15+
<GenerateDocumentationFile Condition="'$(Comments)' == 'true'">true</GenerateDocumentationFile>
1616
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1717
</PropertyGroup>
1818

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
namespace NuGetTemplate;
22

3+
#if Comments
34
/// <summary>
45
/// Some class.
56
/// </summary>
7+
#endif
68
public class Class1
79
{
810
}

Source/NuGetTemplate/Source/NuGetTemplate/NuGetTemplate.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--#if (AuthoringMode)-->
33
<PropertyGroup>
44
<!-- Modify these constants to enable/disable a feature to debug the template. Note that this only affects the C#. -->
5-
<DefineConstants>$(DefineConstants);</DefineConstants>
5+
<DefineConstants>$(DefineConstants);Comments;ImplicitUsings</DefineConstants>
66
<!-- Workaround to build this project: https://github.com/dotnet/templating/issues/1438 -->
77
<Framework>net6.0</Framework>
88
</PropertyGroup>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if (!ImplicitUsings || DotnetFramework)
12
using System;
23

4+
#endif
35
[assembly: CLSCompliant(true)]

Source/NuGetTemplate/Tests/NuGetTemplate.Test/NuGetTemplate.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--#if (AuthoringMode)-->
33
<PropertyGroup>
44
<!-- Modify these constants to enable/disable a feature to debug the template. Note that this only affects the C#. -->
5-
<DefineConstants>$(DefineConstants);</DefineConstants>
5+
<DefineConstants>$(DefineConstants);ImplicitUsings</DefineConstants>
66
<!-- Workaround to build this project: https://github.com/dotnet/templating/issues/1438 -->
77
<Framework>net6.0</Framework>
88
</PropertyGroup>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if (!ImplicitUsings || DotnetFramework)
12
using System;
23

4+
#endif
35
[assembly: CLSCompliant(true)]

0 commit comments

Comments
 (0)