Skip to content

Commit bdcac4a

Browse files
Target .NET 8 and .NET 9
Also update dependencies
1 parent d82eebc commit bdcac4a

15 files changed

Lines changed: 359 additions & 154 deletions

.editorconfig

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = CRLF
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = false
9+
trim_trailing_whitespace = true
10+
11+
[*.sln]
12+
indent_style = tab
13+
14+
[*.{csproj,vbproj,vcxproj,vcxproj.filters}]
15+
indent_size = 2
16+
17+
[*.{xml,config,props,targets,nuspec,ruleset}]
18+
indent_size = 2
19+
20+
[*.{yml,yaml}]
21+
indent_size = 2
22+
23+
[*.json]
24+
indent_size = 2
25+
26+
[*.md]
27+
trim_trailing_whitespace = false
28+
29+
[*.sh]
30+
end_of_line = lf
31+
32+
[*.cs]
33+
# Prefer file scoped namespace declarations
34+
csharp_style_namespace_declarations = file_scoped:warning
35+
36+
# Sort using and Import directives with System.* appearing first
37+
dotnet_sort_system_directives_first = true
38+
dotnet_separate_import_directive_groups = false
39+
40+
# Avoid "this." and "Me." if not necessary
41+
dotnet_style_qualification_for_field = false:refactoring
42+
dotnet_style_qualification_for_property = false:refactoring
43+
dotnet_style_qualification_for_method = false:refactoring
44+
dotnet_style_qualification_for_event = false:refactoring
45+
46+
# Use language keywords instead of framework type names for type references
47+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
48+
dotnet_style_predefined_type_for_member_access = true:suggestion
49+
50+
# Suggest more modern language features when available
51+
dotnet_style_object_initializer = true:suggestion
52+
dotnet_style_collection_initializer = true:suggestion
53+
dotnet_style_coalesce_expression = true:suggestion
54+
dotnet_style_null_propagation = true:suggestion
55+
dotnet_style_explicit_tuple_names = true:suggestion
56+
57+
# Non-private static fields are PascalCase
58+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
59+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
60+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
61+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
62+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
63+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
64+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
65+
66+
# Non-private readonly fields are PascalCase
67+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
68+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
69+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
70+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
71+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
72+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
73+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
74+
75+
# Constants are PascalCase
76+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
77+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
78+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
79+
dotnet_naming_symbols.constants.applicable_kinds = field, local
80+
dotnet_naming_symbols.constants.required_modifiers = const
81+
dotnet_naming_style.constant_style.capitalization = pascal_case
82+
83+
# Instance fields are camelCase and start with _
84+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
85+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
86+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
87+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
88+
dotnet_naming_style.instance_field_style.capitalization = camel_case
89+
dotnet_naming_style.instance_field_style.required_prefix = _
90+
91+
# Locals and parameters are camelCase
92+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
93+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
94+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
95+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
96+
dotnet_naming_style.camel_case_style.capitalization = camel_case
97+
98+
# Local functions are PascalCase
99+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
100+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
101+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
102+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
103+
dotnet_naming_style.local_function_style.capitalization = pascal_case
104+
105+
# By default, name items with PascalCase
106+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
107+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
108+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
109+
dotnet_naming_symbols.all_members.applicable_kinds = *
110+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
111+
112+
# Newline settings
113+
csharp_new_line_before_open_brace = all
114+
csharp_new_line_before_else = true
115+
csharp_new_line_before_catch = true
116+
csharp_new_line_before_finally = true
117+
csharp_new_line_before_members_in_object_initializers = true
118+
csharp_new_line_before_members_in_anonymous_types = true
119+
csharp_new_line_between_query_expression_clauses = true
120+
121+
# Indentation preferences
122+
csharp_indent_block_contents = true
123+
csharp_indent_braces = false
124+
csharp_indent_case_contents = true
125+
csharp_indent_case_contents_when_block = true
126+
csharp_indent_switch_labels = true
127+
csharp_indent_labels = flush_left
128+
129+
# Prefer "var" everywhere
130+
csharp_style_var_for_built_in_types = true:suggestion
131+
csharp_style_var_when_type_is_apparent = true:suggestion
132+
csharp_style_var_elsewhere = true:suggestion
133+
134+
# Prefer method-like constructs to have a block body
135+
csharp_style_expression_bodied_methods = false:none
136+
csharp_style_expression_bodied_constructors = false:none
137+
csharp_style_expression_bodied_operators = false:none
138+
139+
# Prefer property-like constructs to have an expression-body
140+
csharp_style_expression_bodied_properties = true:none
141+
csharp_style_expression_bodied_indexers = true:none
142+
csharp_style_expression_bodied_accessors = true:none
143+
144+
# Suggest more modern language features when available
145+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
146+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
147+
csharp_style_inlined_variable_declaration = true:suggestion
148+
csharp_style_throw_expression = true:suggestion
149+
csharp_style_conditional_delegate_call = true:suggestion
150+
151+
# Space preferences
152+
csharp_space_after_cast = false
153+
csharp_space_after_colon_in_inheritance_clause = true
154+
csharp_space_after_comma = true
155+
csharp_space_after_dot = false
156+
csharp_space_after_keywords_in_control_flow_statements = true
157+
csharp_space_after_semicolon_in_for_statement = true
158+
csharp_space_around_binary_operators = before_and_after
159+
csharp_space_around_declaration_statements = do_not_ignore
160+
csharp_space_before_colon_in_inheritance_clause = true
161+
csharp_space_before_comma = false
162+
csharp_space_before_dot = false
163+
csharp_space_before_open_square_brackets = false
164+
csharp_space_before_semicolon_in_for_statement = false
165+
csharp_space_between_empty_square_brackets = false
166+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
167+
csharp_space_between_method_call_name_and_opening_parenthesis = false
168+
csharp_space_between_method_call_parameter_list_parentheses = false
169+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
170+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
171+
csharp_space_between_method_declaration_parameter_list_parentheses = false
172+
csharp_space_between_parentheses = false
173+
csharp_space_between_square_brackets = false
174+
175+
# Blocks are allowed
176+
csharp_prefer_braces = true:silent
177+
csharp_preserve_single_line_blocks = true
178+
csharp_preserve_single_line_statements = true
179+
180+
# warning RS0037: PublicAPI.txt is missing '#nullable enable'
181+
dotnet_diagnostic.RS0037.severity = none

build.cake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var configuration = Argument("configuration", "Release");
77
Task("Build")
88
.Does(context =>
99
{
10-
DotNetBuild("./src/Spectre.IO.sln", new DotNetBuildSettings {
10+
DotNetBuild("./src/Spectre.IO.slnx", new DotNetBuildSettings {
1111
Configuration = configuration,
1212
NoIncremental = context.HasArgument("rebuild"),
1313
MSBuildSettings = new DotNetMSBuildSettings()
@@ -33,7 +33,7 @@ Task("Package")
3333
var outputPath = MakeAbsolute(Directory("./.artifacts"));
3434

3535
context.CleanDirectory(outputPath.FullPath);
36-
context.DotNetPack($"./src/Spectre.IO.sln", new DotNetPackSettings {
36+
context.DotNetPack($"./src/Spectre.IO.slnx", new DotNetPackSettings {
3737
ArgumentCustomization = args => args.Append($"--property:PackageOutputPath={outputPath.FullPath}"),
3838
Configuration = configuration,
3939
NoRestore = true,

dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "4.0.0",
6+
"version": "5.0.0",
77
"commands": [
88
"dotnet-cake"
99
]

global.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"projects": [ "src" ],
32
"sdk": {
4-
"version": "8.0.302",
3+
"version": "9.0.200",
54
"rollForward": "latestFeature"
65
}
76
}

src/.editorconfig

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
[*]
2-
indent_style = space
1+
root = false
2+
3+
[*.cs]
4+
# IDE0055: Fix formatting
5+
dotnet_diagnostic.IDE0055.severity = warning
36

47
# SA1101: Prefix local calls with this
58
dotnet_diagnostic.SA1101.severity = none
69

10+
# SA1600: Elements should be documented
11+
dotnet_diagnostic.SA1600.severity = none
12+
713
# SA1633: File should have header
814
dotnet_diagnostic.SA1633.severity = none
915

16+
# CS1591: Missing XML comment for publicly visible type or member
17+
dotnet_diagnostic.CS1591.severity = none
18+
19+
# SA1200: Using directives should be placed correctly
20+
dotnet_diagnostic.SA1200.severity = none
21+
1022
# SA1201: Elements should appear in the correct order
1123
dotnet_diagnostic.SA1201.severity = none
1224

25+
# SA1202: Public members should come before private members
26+
dotnet_diagnostic.SA1202.severity = none
27+
1328
# SA1309: Field names should not begin with underscore
1429
dotnet_diagnostic.SA1309.severity = none
1530

@@ -39,3 +54,63 @@ dotnet_diagnostic.SA1625.severity = none
3954

4055
# IDE0005: Using directive is unnecessary
4156
dotnet_diagnostic.IDE0005.severity = warning
57+
58+
# SA1117: Parameters should be on same line or separate lines
59+
dotnet_diagnostic.SA1117.severity = none
60+
61+
# SA1404: Code analysis suppression should have justification
62+
dotnet_diagnostic.SA1404.severity = none
63+
64+
# SA1101: Prefix local calls with this
65+
dotnet_diagnostic.SA1101.severity = none
66+
67+
# SA1633: File should have header
68+
dotnet_diagnostic.SA1633.severity = none
69+
70+
# SA1649: File name should match first type name
71+
dotnet_diagnostic.SA1649.severity = none
72+
73+
# SA1402: File may only contain a single type
74+
dotnet_diagnostic.SA1402.severity = none
75+
76+
# CA1814: Prefer jagged arrays over multidimensional
77+
dotnet_diagnostic.CA1814.severity = none
78+
79+
# RCS1194: Implement exception constructors.
80+
dotnet_diagnostic.RCS1194.severity = none
81+
82+
# CA1032: Implement standard exception constructors
83+
dotnet_diagnostic.CA1032.severity = none
84+
85+
# CA1826: Do not use Enumerable methods on indexable collections. Instead use the collection directly
86+
dotnet_diagnostic.CA1826.severity = none
87+
88+
# RCS1079: Throwing of new NotImplementedException.
89+
dotnet_diagnostic.RCS1079.severity = warning
90+
91+
# RCS1057: Add empty line between declarations.
92+
dotnet_diagnostic.RCS1057.severity = none
93+
94+
# RCS1057: Validate arguments correctly
95+
dotnet_diagnostic.RCS1227.severity = none
96+
97+
# IDE0004: Remove Unnecessary Cast
98+
dotnet_diagnostic.IDE0004.severity = warning
99+
100+
# CA1810: Initialize reference type static fields inline
101+
dotnet_diagnostic.CA1810.severity = none
102+
103+
# IDE0044: Add readonly modifier
104+
dotnet_diagnostic.IDE0044.severity = warning
105+
106+
# RCS1047: Non-asynchronous method name should not end with 'Async'.
107+
dotnet_diagnostic.RCS1047.severity = none
108+
109+
# RCS1090: Call 'ConfigureAwait(false)'.
110+
dotnet_diagnostic.RCS1090.severity = warning
111+
112+
# SA1602: Enumeration items should be documented
113+
dotnet_diagnostic.SA1602.severity = none
114+
115+
# SA1118: The parameter spans multiple lines
116+
dotnet_diagnostic.SA1118.severity = none

src/Directory.Build.props

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<Project>
22
<PropertyGroup Label="Settings">
3-
<Deterministic>true</Deterministic>
4-
<LangVersion>10.0</LangVersion>
5-
<IncludeSymbols>true</IncludeSymbols>
6-
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
7-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3+
<LangVersion>13</LangVersion>
4+
<ImplicitUsings>true</ImplicitUsings>
5+
<Deterministic>true</Deterministic>
6+
<Nullable>enable</Nullable>
7+
<DebugSymbols>true</DebugSymbols>
8+
<DebugType>embedded</DebugType>
9+
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<IsPackable>false</IsPackable>
812
</PropertyGroup>
913

1014
<PropertyGroup Label="Deterministic Build" Condition="'$(GITHUB_ACTIONS)' == 'true'">
@@ -32,12 +36,12 @@
3236
</PropertyGroup>
3337

3438
<ItemGroup Label="Package References">
35-
<PackageReference Include="MinVer" PrivateAssets="All" Version="5.0.0"/>
36-
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="8.0.0"/>
37-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
39+
<PackageReference Include="MinVer" PrivateAssets="All"/>
40+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
41+
<PackageReference Include="StyleCop.Analyzers">
3842
<PrivateAssets>All</PrivateAssets>
3943
</PackageReference>
40-
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4">
44+
<PackageReference Include="Roslynator.Analyzers">
4145
<PrivateAssets>All</PrivateAssets>
4246
</PackageReference>
4347
</ItemGroup>

src/Directory.Packages.props

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
7+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
8+
<PackageVersion Include="MinVer" Version="6.0.0" />
9+
<PackageVersion Include="NSubstitute" Version="5.3.0" />
10+
<PackageVersion Include="Roslynator.Analyzers" Version="4.14.0" />
11+
<PackageVersion Include="Shouldly" Version="4.3.0" />
12+
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
13+
<PackageVersion Include="xunit" Version="2.9.3" />
14+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3" />
15+
</ItemGroup>
16+
</Project>

0 commit comments

Comments
 (0)