Skip to content

Commit 94326ca

Browse files
committed
test: add test coverage settings
1 parent 14362b6 commit 94326ca

3 files changed

Lines changed: 225 additions & 0 deletions

File tree

.editorconfig

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Top-most EditorConfig file
2+
root = true
3+
4+
# ─── Universal ───────────────────────────────────────────────────────────────
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
# ─── Solution / project files ────────────────────────────────────────────────
14+
[*.{sln,csproj,props,targets}]
15+
indent_size = 2
16+
17+
# ─── JSON / YAML / XML config ────────────────────────────────────────────────
18+
[*.{json,yml,yaml,xml,config,runsettings,}]
19+
indent_size = 2
20+
21+
# ─── Markdown ────────────────────────────────────────────────────────────────
22+
[*.md]
23+
trim_trailing_whitespace = false
24+
25+
# ─── C# ──────────────────────────────────────────────────────────────────────
26+
[*.cs]
27+
28+
# --- Formatting: indentation & spacing ---------------------------------------
29+
csharp_indent_case_contents = true
30+
csharp_indent_switch_labels = true
31+
csharp_space_after_cast = false
32+
csharp_space_after_keywords_in_control_flow_statements = true
33+
csharp_space_between_method_declaration_parameter_list_parentheses = false
34+
csharp_space_between_method_call_parameter_list_parentheses = false
35+
csharp_space_before_colon_in_inheritance_clause = true
36+
csharp_space_after_colon_in_inheritance_clause = true
37+
38+
# --- Formatting: new lines ---------------------------------------------------
39+
csharp_new_line_before_open_brace = all
40+
csharp_new_line_before_else = true
41+
csharp_new_line_before_catch = true
42+
csharp_new_line_before_finally = true
43+
csharp_new_line_before_members_in_object_initializers = true
44+
csharp_new_line_before_members_in_anonymous_types = true
45+
csharp_new_line_between_query_expression_clauses = true
46+
47+
# --- Formatting: wrapping ----------------------------------------------------
48+
csharp_preserve_single_line_statements = false
49+
csharp_preserve_single_line_blocks = true
50+
51+
# --- Language rules: this. qualification -------------------------------------
52+
dotnet_style_qualification_for_field = false:warning
53+
dotnet_style_qualification_for_property = false:warning
54+
dotnet_style_qualification_for_method = false:warning
55+
dotnet_style_qualification_for_event = false:warning
56+
57+
# --- Language rules: built-in type aliases -----------------------------------
58+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
59+
dotnet_style_predefined_type_for_member_access = true:warning
60+
61+
# --- Language rules: var usage -----------------------------------------------
62+
csharp_style_var_for_built_in_types = false:warning
63+
csharp_style_var_when_type_is_apparent = true:suggestion
64+
csharp_style_var_elsewhere = false:suggestion
65+
66+
# --- Language rules: expression-bodied members -------------------------------
67+
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
68+
csharp_style_expression_bodied_constructors = false:warning
69+
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
70+
csharp_style_expression_bodied_properties = true:suggestion
71+
csharp_style_expression_bodied_indexers = true:suggestion
72+
csharp_style_expression_bodied_accessors = true:suggestion
73+
csharp_style_expression_bodied_lambdas = true:suggestion
74+
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
75+
76+
# --- Language rules: pattern matching ----------------------------------------
77+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
78+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
79+
csharp_style_prefer_switch_expression = true:suggestion
80+
csharp_style_prefer_pattern_matching = true:suggestion
81+
csharp_style_prefer_not_pattern = true:suggestion
82+
csharp_style_prefer_extended_property_pattern = true:suggestion
83+
84+
# --- Language rules: null checking -------------------------------------------
85+
csharp_style_prefer_null_coalescing_assignment = true:warning
86+
dotnet_style_null_propagation = true:warning
87+
dotnet_style_prefer_is_null_check_for_reference_equality_checks = true:warning
88+
csharp_style_throw_expression = true:suggestion
89+
csharp_style_conditional_delegate_call = true:warning
90+
91+
# --- Language rules: modern C# features --------------------------------------
92+
csharp_style_prefer_primary_constructors = true:suggestion
93+
csharp_style_prefer_collection_expressions = true:suggestion
94+
csharp_prefer_simple_default_expression = true:warning
95+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
96+
csharp_style_prefer_index_operator = true:suggestion
97+
csharp_style_prefer_range_operator = true:suggestion
98+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
99+
csharp_style_prefer_tuple_swap = true:suggestion
100+
csharp_style_prefer_utf8_string_literals = true:suggestion
101+
102+
# --- Language rules: using directives ----------------------------------------
103+
csharp_using_directive_placement = outside_namespace:warning
104+
dotnet_sort_system_directives_first = true
105+
dotnet_separate_import_directive_groups = false
106+
107+
# --- Language rules: namespace style -----------------------------------------
108+
csharp_style_namespace_declarations = file_scoped:warning
109+
110+
# --- Language rules: modifiers -----------------------------------------------
111+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
112+
csharp_prefer_static_local_function = true:suggestion
113+
dotnet_style_readonly_field = true:warning
114+
csharp_style_prefer_readonly_struct = true:suggestion
115+
csharp_style_prefer_readonly_struct_member = true:suggestion
116+
117+
# --- Language rules: code block preferences ----------------------------------
118+
csharp_prefer_braces = true:warning
119+
csharp_prefer_simple_using_statement = true:suggestion
120+
csharp_style_prefer_method_group_conversion = true:suggestion
121+
csharp_style_prefer_top_level_statements = true:suggestion
122+
123+
# --- Dotnet style: object/collection initializers ----------------------------
124+
dotnet_style_object_initializer = true:suggestion
125+
dotnet_style_collection_initializer = true:suggestion
126+
dotnet_style_prefer_collection_expression = true:suggestion
127+
dotnet_style_explicit_tuple_names = true:warning
128+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
129+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
130+
dotnet_style_prefer_auto_properties = true:suggestion
131+
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
132+
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
133+
dotnet_style_prefer_compound_assignment = true:warning
134+
dotnet_style_prefer_simplified_interpolation = true:suggestion
135+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
136+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
137+
138+
# --- Naming conventions ------------------------------------------------------
139+
# Interfaces: IPascalCase
140+
dotnet_naming_rule.interface_should_be_prefixed_with_i.severity = warning
141+
dotnet_naming_rule.interface_should_be_prefixed_with_i.symbols = interface
142+
dotnet_naming_rule.interface_should_be_prefixed_with_i.style = prefix_i_style
143+
144+
dotnet_naming_symbols.interface.applicable_kinds = interface
145+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal
146+
147+
dotnet_naming_style.prefix_i_style.required_prefix = I
148+
dotnet_naming_style.prefix_i_style.capitalization = pascal_case
149+
150+
# Type parameters: TPascalCase
151+
dotnet_naming_rule.type_parameters_should_be_prefixed_with_t.severity = warning
152+
dotnet_naming_rule.type_parameters_should_be_prefixed_with_t.symbols = type_parameter
153+
dotnet_naming_rule.type_parameters_should_be_prefixed_with_t.style = prefix_t_style
154+
155+
dotnet_naming_symbols.type_parameter.applicable_kinds = type_parameter
156+
dotnet_naming_style.prefix_t_style.required_prefix = T
157+
dotnet_naming_style.prefix_t_style.capitalization = pascal_case
158+
159+
# Private fields: _camelCase
160+
dotnet_naming_rule.private_fields_should_be_camel_case.severity = warning
161+
dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields
162+
dotnet_naming_rule.private_fields_should_be_camel_case.style = underscore_camel_case_style
163+
164+
dotnet_naming_symbols.private_fields.applicable_kinds = field
165+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected
166+
167+
dotnet_naming_style.underscore_camel_case_style.required_prefix = _
168+
dotnet_naming_style.underscore_camel_case_style.capitalization = camel_case
169+
170+
# Async methods: PascalCaseAsync
171+
dotnet_naming_rule.async_methods_end_in_async.severity = warning
172+
dotnet_naming_rule.async_methods_end_in_async.symbols = async_methods
173+
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async_style
174+
175+
dotnet_naming_symbols.async_methods.applicable_kinds = method
176+
dotnet_naming_symbols.async_methods.required_modifiers = async
177+
178+
dotnet_naming_style.end_in_async_style.required_suffix = Async
179+
dotnet_naming_style.end_in_async_style.capitalization = pascal_case
180+
181+
# Constants: PascalCase
182+
dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
183+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
184+
dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case_style
185+
186+
dotnet_naming_symbols.constants.applicable_kinds = field, local
187+
dotnet_naming_symbols.constants.required_modifiers = const
188+
189+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
190+
191+
# ─── Analyzer severity overrides ─────────────────────────────────────────────
192+
[*.cs]
193+
# Treat style violations as build warnings (enforced in CI via -warnaserror)
194+
dotnet_analyzer_diagnostic.category-Style.severity = warning
195+
# Uncomment to escalate to errors in CI:
196+
# dotnet_analyzer_diagnostic.category-Style.severity = error

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ obj/
1010
## IDE
1111
.vs/
1212
.idea/
13+
.pkl-lsp/
1314
*.swp
1415
*~
1516

@@ -27,6 +28,11 @@ publish/
2728
project.lock.json
2829
project.fragment.lock.json
2930
artifacts/
31+
format-report.json
32+
33+
# Test Coverage
34+
**/TestResults/
35+
coverage.*
3036

3137
## User secrets
3238
secrets.json

coverlet.runsettings

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<DataCollectionRunSettings>
4+
<DataCollectors>
5+
<DataCollector friendlyName="XPlat Code Coverage">
6+
<Configuration>
7+
<Format>cobertura</Format>
8+
<!-- DI wiring bootstrapping code -->
9+
<!-- SqsMessageQueue, ScanEventRepository, DatabaseInitializer are integration-test only
10+
(ADR-001) -->
11+
<Exclude>[ScanEventWorker]ScanEventWorker.Infrastructure.*,[ScanEventWorker]Program</Exclude>
12+
<!-- STJ JsonSerializerContext source-gen partials (ApiJsonContext) -->
13+
<ExcludeByAttribute>GeneratedCodeAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
14+
<!-- other generated files -->
15+
<ExcludeByFile>**/obj/**/*.cs</ExcludeByFile>
16+
<Threshold>80</Threshold>
17+
<ThresholdType>line</ThresholdType>
18+
<ThresholdStat>minimum</ThresholdStat>
19+
</Configuration>
20+
</DataCollector>
21+
</DataCollectors>
22+
</DataCollectionRunSettings>
23+
</RunSettings>

0 commit comments

Comments
 (0)