Skip to content

Commit 19906e7

Browse files
authored
Refactor port to triple slash (#164)
Use the Roslyn SyntaxFactory properly to generate the elements. Adjust the tests. Add some minor infra changes.
1 parent d06afd5 commit 19906e7

36 files changed

+1757
-2393
lines changed

Diff for: .editorconfig

+19-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ charset = utf-8
1717
# Generated code
1818
[*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}]
1919
generated_code = true
20+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
21+
tab_width = 4
22+
dotnet_style_coalesce_expression = true:suggestion
23+
dotnet_style_null_propagation = true:suggestion
24+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
2025

2126
# C# files
2227
[*.cs]
@@ -56,15 +61,15 @@ dotnet_style_predefined_type_for_member_access = true:suggestion
5661
# name all constant fields using PascalCase
5762
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
5863
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
59-
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
64+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
6065
dotnet_naming_symbols.constant_fields.applicable_kinds = field
6166
dotnet_naming_symbols.constant_fields.required_modifiers = const
6267
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
6368

6469
# static fields should have s_ prefix
6570
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
6671
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
67-
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
72+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
6873
dotnet_naming_symbols.static_fields.applicable_kinds = field
6974
dotnet_naming_symbols.static_fields.required_modifiers = static
7075
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
@@ -74,7 +79,7 @@ dotnet_naming_style.static_prefix_style.capitalization = camel_case
7479
# internal and private fields should be _camelCase
7580
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
7681
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
77-
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
82+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
7883
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
7984
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
8085
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
@@ -157,8 +162,19 @@ csharp_space_between_square_brackets = false
157162
dotnet_diagnostic.IDE0073.severity = error
158163
# License header
159164
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.
165+
csharp_style_namespace_declarations = block_scoped:silent
166+
csharp_style_prefer_method_group_conversion = true:silent
167+
csharp_style_prefer_top_level_statements = true:silent
168+
csharp_style_prefer_primary_constructors = true:suggestion
169+
170+
# IDE0060: Remove unused parameter
171+
dotnet_diagnostic.IDE0060.severity = error
160172

161173
# C++ Files
174+
175+
# xUnit1006: Theory methods should have parameters
176+
dotnet_diagnostic.xUnit1006.severity = error
177+
162178
[*.{cpp,h,in}]
163179
curly_bracket_next_line = true
164180
indent_brace_style = Allman

Diff for: .gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ syntax: glob
1414
*.sln.docstates
1515
launchSettings.json
1616

17+
# Live Unit Tests
18+
.lutignore
19+
*.lutconfig
20+
1721
# Build results
1822

1923
artifacts/
@@ -130,4 +134,4 @@ node_modules/
130134

131135
# Python Compile Outputs
132136

133-
*.pyc
137+
*.pyc

Diff for: src/Directory.Build.props

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
4+
</PropertyGroup>
5+
</Project>

Diff for: src/PortToTripleSlash/src/libraries/Configuration.cs

+18-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ private enum Mode
2525
Initial,
2626
IsMono,
2727
SkipInterfaceImplementations,
28-
SkipInterfaceRemarks
28+
SkipInterfaceRemarks,
29+
SkipRemarks
2930
}
3031

3132
// The default boilerplate string for what dotnet-api-docs
@@ -64,6 +65,7 @@ private enum Mode
6465
public bool IsMono { get; set; }
6566
public bool SkipInterfaceImplementations { get; set; } = false;
6667
public bool SkipInterfaceRemarks { get; set; } = true;
68+
public bool SkipRemarks { get; set; } = true;
6769

6870
public static Configuration GetCLIArguments(string[] args)
6971
{
@@ -331,6 +333,10 @@ public static Configuration GetCLIArguments(string[] args)
331333
mode = Mode.SkipInterfaceRemarks;
332334
break;
333335

336+
case "-SKIPREMARKS":
337+
mode = Mode.SkipRemarks;
338+
break;
339+
334340
default:
335341
Log.ErrorAndExit($"Unrecognized argument: {arg}");
336342
break;
@@ -358,6 +364,13 @@ public static Configuration GetCLIArguments(string[] args)
358364
break;
359365
}
360366

367+
case Mode.SkipRemarks:
368+
{
369+
config.SkipRemarks = ParseOrExit(arg, nameof(Mode.SkipRemarks));
370+
mode = Mode.Initial;
371+
break;
372+
}
373+
361374
default:
362375
{
363376
Log.ErrorAndExit("Unexpected mode.");
@@ -490,6 +503,10 @@ Whether you want interface implementation remarks to be used when the API itself
490503
the interface API.
491504
Usage example:
492505
-SkipInterfaceRemarks false
506+
-SkipRemarks bool Default is true (excludes remarks).
507+
Whether you want to backport remarks.
508+
Usage example:
509+
-SkipRemarks true
493510
");
494511
Log.Warning(@"
495512
TL;DR:

0 commit comments

Comments
 (0)