Skip to content

Commit e6007c7

Browse files
committed
ci: make doclint incremental and fix missing scaladoc in schema witness
1 parent 32ab8a6 commit e6007c7

3 files changed

Lines changed: 52 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ jobs:
8686
id: docs_changes
8787
uses: dorny/paths-filter@v3
8888
with:
89+
list-files: shell
8990
filters: |
9091
docs:
9192
- 'docs/**'
9293
- '**/*.md'
9394
- 'scripts/lint-docs.sh'
94-
- 'scripts/doclint.sh'
95+
api_scala:
96+
- 'modules/core/src/main/**/*.scala'
97+
- 'modules/contracts/src/main/**/*.scala'
9598
- name: Skip docs lint (no docs changes)
9699
if: steps.docs_changes.outputs.docs != 'true'
97100
run: echo "No docs changes detected; skipping docs lint."
@@ -102,7 +105,9 @@ jobs:
102105
if: steps.docs_changes.outputs.docs == 'true'
103106
run: bash scripts/lint-docs.sh
104107
- name: Scaladoc coverage lint
105-
if: steps.docs_changes.outputs.docs == 'true'
108+
if: steps.docs_changes.outputs.api_scala == 'true'
109+
env:
110+
DOC_LINT_FILES: ${{ steps.docs_changes.outputs.api_scala_files }}
106111
run: |
107112
chmod +x scripts/doclint.sh
108113
./scripts/doclint.sh

modules/core/src/main/scala-2/com/flowforge/core/types/SchemaWitness.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import scala.annotation.implicitNotFound
4545
)
4646
sealed trait SchemaWitness[PipelineOut, Contract, Policy <: SchemaEvolutionPolicy]
4747

48+
/** Companion with implicit evidence constructors for schema compatibility policies. */
4849
object SchemaWitness {
4950

5051
// Type alias for migration - use SchemaConforms instead
@@ -121,8 +122,10 @@ object SchemaEvolutionPolicy {
121122
║ 🔧 Fix: Ensure all fields in subset exist in superset with same types. ║
122123
╚════════════════════════════════════════════════════════════════════════════════╝
123124
""")
125+
/** Evidence that `Subset` is contained within `Superset` at the HList field/type level. */
124126
trait SubsetSchema[Subset <: HList, Superset <: HList]
125127

128+
/** Constructors for subset evidence used by backward/forward compatibility witnesses. */
126129
object SubsetSchema {
127130

128131
/**

scripts/doclint.sh

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,50 @@ set -euo pipefail
88
ROOTS=(modules/core modules/contracts)
99
MISS=0
1010
echo "🔎 Doc lint: scanning for missing Scaladoc on public declarations"
11-
for r in "${ROOTS[@]}"; do
12-
while IFS= read -r -d '' f; do
13-
lines=()
14-
while IFS= read -r line; do
15-
lines+=("$line")
16-
done < <(nl -ba "$f")
17-
for ((i=0; i<${#lines[@]}; i++)); do
18-
L="${lines[$i]}"
19-
# Match top-level public declarations (very simple heuristic)
20-
if [[ "$L" =~ [[:space:]]+[0-9]+[[:space:]]+(trait|class|object)[[:space:]]+[A-Z][A-Za-z0-9_]*[[:space:]]*\{? ]]; then
21-
# Look back a few lines for a /** ... */ opener
22-
hasdoc=0
23-
for b in 1 2 3 4 5; do
24-
j=$((i-b))
25-
if (( j >= 0 )); then
26-
if [[ "${lines[$j]}" =~ \/\*\* ]]; then hasdoc=1; break; fi
27-
if [[ "${lines[$j]}" =~ ^[[:space:]]*$ ]]; then continue; fi
28-
fi
29-
done
30-
if (( hasdoc == 0 )); then
31-
echo "⚠️ Missing Scaladoc: $f:${L%%$'\t'*}"
32-
((MISS++))
11+
scan_file() {
12+
local f="$1"
13+
lines=()
14+
while IFS= read -r line; do
15+
lines+=("$line")
16+
done < <(nl -ba "$f")
17+
for ((i=0; i<${#lines[@]}; i++)); do
18+
L="${lines[$i]}"
19+
# Match top-level public declarations (very simple heuristic)
20+
if [[ "$L" =~ [[:space:]]+[0-9]+[[:space:]]+(trait|class|object)[[:space:]]+[A-Z][A-Za-z0-9_]*[[:space:]]*\{? ]]; then
21+
# Look back a few lines for a /** ... */ opener
22+
hasdoc=0
23+
for b in 1 2 3 4 5; do
24+
j=$((i-b))
25+
if (( j >= 0 )); then
26+
if [[ "${lines[$j]}" =~ \/\*\* ]]; then hasdoc=1; break; fi
27+
if [[ "${lines[$j]}" =~ ^[[:space:]]*$ ]]; then continue; fi
3328
fi
29+
done
30+
if (( hasdoc == 0 )); then
31+
echo "⚠️ Missing Scaladoc: $f:${L%%$'\t'*}"
32+
((MISS++))
3433
fi
35-
done
36-
done < <(find "$r" -type f -path "*/src/main/*" -name "*.scala" -print0)
37-
done
34+
fi
35+
done
36+
}
37+
38+
if [[ -n "${DOC_LINT_FILES:-}" ]]; then
39+
while IFS= read -r f; do
40+
[[ -z "$f" ]] && continue
41+
[[ ! -f "$f" ]] && continue
42+
case "$f" in
43+
modules/core/src/main/*|modules/contracts/src/main/*)
44+
scan_file "$f"
45+
;;
46+
esac
47+
done <<< "${DOC_LINT_FILES}"
48+
else
49+
for r in "${ROOTS[@]}"; do
50+
while IFS= read -r -d '' f; do
51+
scan_file "$f"
52+
done < <(find "$r" -type f -path "*/src/main/*" -name "*.scala" -print0)
53+
done
54+
fi
3855

3956
echo "Doclint: $MISS items missing Scaladoc"
4057
if (( MISS > 0 )); then

0 commit comments

Comments
 (0)