Skip to content

Commit b28121f

Browse files
committed
Add build-time complexity quality gate
1 parent 90c5391 commit b28121f

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ dotnet_diagnostic.CA1010.severity = none
143143

144144
# Use collection expressions (C# 12+)
145145
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
146+
dotnet_diagnostic.CA1502.severity = warning
146147

147148
# Code block preferences
148149
csharp_prefer_simple_default_expression = true:suggestion

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ For this app:
138138
- `LangVersion` is pinned to `latest` at the root
139139
- the repo-root lowercase `.editorconfig` is the source of truth for formatting, naming, style, and analyzer severity
140140
- local and CI build commands must pass `-warnaserror`; warnings are not an acceptable "green" build state in this repository
141+
- quality gates should prefer analyzer-backed build failures over separate one-off CI tools; for overloaded methods and maintainability drift, enable build-time analyzers such as `CA1502` instead of adding a formatting-only gate
141142
- `Directory.Build.props` owns the shared analyzer and warning policy for future projects
142143
- `Directory.Packages.props` owns centrally managed package versions
143144
- `global.json` pins the .NET SDK and Uno SDK version used by the app and tests

CodeMetricsConfig.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Tighten maintainability checks enough to catch genuinely overloaded methods
2+
# without turning the first pass into pure noise.
3+
CA1502(Method): 15

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919
<NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257</NoWarn>
2020

2121
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeMetricsConfig.txt" Link="CodeMetricsConfig.txt" />
25+
</ItemGroup>
2226
</Project>

github-actions-yaml-review.plan.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Goal
44

5-
Review the current GitHub Actions validation and release workflows, record concrete risks with line-level evidence, and capture any durable CI policy that emerged from the user conversation, including mandatory `-warnaserror` enforcement for local and CI builds and keeping formatting as a local pre-push concern instead of a CI gate.
5+
Review the current GitHub Actions validation and release workflows, record concrete risks with line-level evidence, and capture any durable CI policy that emerged from the user conversation, including mandatory `-warnaserror` enforcement for local and CI builds, keeping formatting as a local pre-push concern instead of a CI gate, and preferring analyzer-backed quality gates for overloaded methods.
66

77
## Scope
88

@@ -11,7 +11,7 @@ Review the current GitHub Actions validation and release workflows, record concr
1111
- `.github/workflows/build-validation.yml`
1212
- `.github/workflows/release-publish.yml`
1313
- shared workflow assumptions from `.github/steps/install_dependencies/action.yml`
14-
- root governance updates needed to capture durable CI runner policy, mandatory `-warnaserror` build usage, and local-only formatting policy
14+
- root governance updates needed to capture durable CI runner policy, mandatory `-warnaserror` build usage, local-only formatting policy, and analyzer-backed maintainability gates
1515

1616
### Out Of Scope
1717

@@ -68,9 +68,17 @@ Review the current GitHub Actions validation and release workflows, record concr
6868
- findings are ordered by severity
6969
Done when: the user can act on the review without needing another pass to discover the real problems.
7070

71-
- [x] Step 6: Validate touched YAML/policy files.
71+
- [x] Step 6: Add analyzer-backed maintainability gating for overloaded methods.
72+
Verification:
73+
- enable `CA1502` in `.editorconfig`
74+
- attach a repo-level `CodeMetricsConfig.txt` threshold through `Directory.Build.props`
75+
- `dotnet build DotPilot.slnx -warnaserror` stays green
76+
Done when: excessive method complexity is enforced by the normal build gate instead of a standalone CI helper step.
77+
78+
- [x] Step 7: Validate touched YAML/policy files.
7279
Verification:
7380
- `dotnet build DotPilot.slnx -warnaserror`
81+
- `dotnet test DotPilot.slnx`
7482
- `actionlint .github/workflows/build-validation.yml`
7583
- `actionlint .github/workflows/release-publish.yml`
7684
Done when: touched workflow files still parse cleanly.

0 commit comments

Comments
 (0)