Rust checks / check (ubuntu-latest) (push) Canceled after 0s
Rust checks / check (windows-latest) (push) Canceled after 0s
29 lines
1.4 KiB
PowerShell
29 lines
1.4 KiB
PowerShell
# Run from the isolated worktree root. Counts rustfmt lines, not complexity.
|
|
$r3B = @(git show 8ac9f46:experiments/r3-facet-carrier/src/lib.rs)
|
|
$r3C = @(Get-Content -LiteralPath experiments/r3-facet-carrier/src/typed_reviews.rs)
|
|
$r3Tests = @(Get-Content -LiteralPath experiments/r3-facet-carrier/src/typed_reviews_tests.rs)
|
|
function Count-R3Lines($Lines) {
|
|
@($Lines | Where-Object { $_.Trim().Length -gt 0 -and -not $_.Trim().StartsWith('//') }).Count
|
|
}
|
|
function Find-R3Line($Lines, $Prefix) {
|
|
for ($r3Index = 0; $r3Index -lt $Lines.Length; $r3Index++) {
|
|
if ($Lines[$r3Index].StartsWith($Prefix)) { return $r3Index }
|
|
}
|
|
throw "Missing section marker: $Prefix"
|
|
}
|
|
$r3BOwn = Find-R3Line $r3B 'pub fn own('
|
|
$r3BCopy = Find-R3Line $r3B 'fn copy('
|
|
$r3BTests = Find-R3Line $r3B '#[cfg(test)]'
|
|
$r3CAdapter = Find-R3Line $r3C '// ADAPTER:'
|
|
$r3CTestStart = Find-R3Line $r3C '#[cfg(test)]'
|
|
[ordered]@{
|
|
method = 'Nonblank non-comment rustfmt lines; excludes test module registration'
|
|
b_public = Count-R3Lines $r3B[5..($r3BOwn-1)]
|
|
shared_record_helpers = Count-R3Lines $r3B[$r3BOwn..($r3BCopy-1)]
|
|
b_adapter = Count-R3Lines $r3B[$r3BCopy..($r3BTests-1)]
|
|
b_tests = Count-R3Lines $r3B[($r3BTests+1)..($r3B.Length-1)]
|
|
c_public = Count-R3Lines $r3C[5..($r3CAdapter-1)]
|
|
c_adapter = Count-R3Lines $r3C[$r3CAdapter..($r3CTestStart-1)]
|
|
c_tests = Count-R3Lines $r3Tests
|
|
} | ConvertTo-Json
|