Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ jobs:
git commit -m "style: auto-fix formatting [skip ci]"
git push

- name: Validate docs.json
run: node -e "JSON.parse(require('fs').readFileSync('docs.json','utf8'))"

- name: Check navigation sync
id: nav-sync
run: npm run lint:nav

- name: Check broken links
id: broken-links
continue-on-error: true
run: npx mint broken-links 2>&1 | tee broken-links.log

- name: Check accessibility
Expand All @@ -64,7 +70,7 @@ jobs:
run: npx mint openapi-check api-reference/openapi.yaml 2>&1 | tee openapi.log

- name: Report issues on PR
if: github.event_name == 'pull_request' && (steps.broken-links.outcome == 'failure' || steps.a11y.outcome == 'failure' || steps.openapi.outcome == 'failure')
if: always() && github.event_name == 'pull_request' && (steps.nav-sync.outcome == 'failure' || steps.broken-links.outcome == 'failure' || steps.a11y.outcome == 'failure' || steps.openapi.outcome == 'failure')
uses: actions/github-script@v8
with:
script: |
Expand All @@ -75,6 +81,9 @@ jobs:
const a11y = fs.existsSync('a11y.log') ? fs.readFileSync('a11y.log', 'utf8') : '';
const openapi = fs.existsSync('openapi.log') ? fs.readFileSync('openapi.log', 'utf8') : '';

if ('${{ steps.nav-sync.outcome }}' === 'failure') {
body += '### Navigation Sync\nPages referenced in `docs.json` do not match files on disk. Run `npm run lint:nav` locally for details.\n\n';
}
if ('${{ steps.broken-links.outcome }}' === 'failure') {
body += '### Broken Links\n```\n' + brokenLinks.slice(0, 2000) + '\n```\n\n';
}
Expand All @@ -93,7 +102,7 @@ jobs:
});

- name: Fail if validation errors
if: steps.broken-links.outcome == 'failure' || steps.a11y.outcome == 'failure' || steps.openapi.outcome == 'failure'
if: always() && (steps.nav-sync.outcome == 'failure' || steps.broken-links.outcome == 'failure' || steps.a11y.outcome == 'failure' || steps.openapi.outcome == 'failure')
run: |
echo "Validation failed. Check the logs above."
exit 1
67 changes: 67 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

echo "Running pre-push validation..."
echo ""

failed=0

# Navigation sync (fast, pure Node — run first)
echo "==> Checking navigation/file sync..."
if npm run lint:nav; then
echo " Navigation sync passed."
else
echo " Navigation sync FAILED."
failed=1
fi

echo ""

# Run mint checks in parallel using background jobs
echo "==> Running link and accessibility checks in parallel..."

tmpdir=$(mktemp -d)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This script creates a temporary directory but doesn't handle its cleanup if the script is interrupted (e.g., with Ctrl+C). This could leave temporary files on the system. It's also good practice to handle potential failures from mktemp.

I suggest adding a trap to ensure the temporary directory is always removed on script exit and to exit if mktemp fails.

Suggested change
tmpdir=$(mktemp -d)
tmpdir=$(mktemp -d) || { echo "Failed to create temporary directory" >&2; exit 1; }
trap 'rm -rf -- "$tmpdir"' EXIT


(npx mint broken-links > "$tmpdir/links.log" 2>&1; echo $? > "$tmpdir/links.exit") &
pid_links=$!

(npx mint a11y > "$tmpdir/a11y.log" 2>&1; echo $? > "$tmpdir/a11y.exit") &
pid_a11y=$!

# Wait for both to finish
wait $pid_links
wait $pid_a11y

# Report results
links_exit=$(cat "$tmpdir/links.exit")
a11y_exit=$(cat "$tmpdir/a11y.exit")

echo ""
echo "--- Broken Links ---"
if [ "$links_exit" -eq 0 ]; then
echo " Passed."
else
cat "$tmpdir/links.log"
echo " Broken links check FAILED."
failed=1
fi

echo ""
echo "--- Accessibility ---"
if [ "$a11y_exit" -eq 0 ]; then
echo " Passed."
else
cat "$tmpdir/a11y.log"
echo " Accessibility check FAILED."
failed=1
fi

# Cleanup
rm -rf "$tmpdir"

echo ""
if [ "$failed" -ne 0 ]; then
echo "Pre-push validation FAILED. Push aborted."
exit 1
fi

echo "All pre-push checks passed."
2 changes: 1 addition & 1 deletion analyzers/rules/AL0052.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ dotnet_diagnostic.AL0052.severity = error

- [AL0044 - AotSafe code must not call RequiresDynamicCode methods](/analyzers/rules/AL0044)
- [AL0053 - Unnecessary AotUnsafe attribute](/analyzers/rules/AL0053)
- [AotUnsafe attribute documentation](/utilities/aot-testing)
- AotUnsafe attribute documentation
2 changes: 1 addition & 1 deletion analyzers/rules/AL0053.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ The analyzer recognizes these as legitimate reasons for `[AotUnsafe]`:

- [AL0052 - AotSafe code must not call AotUnsafe code](/analyzers/rules/AL0052)
- [AL0044 - AotSafe code must not call RequiresDynamicCode methods](/analyzers/rules/AL0044)
- [AotUnsafe attribute documentation](/utilities/aot-testing)
- AotUnsafe attribute documentation
210 changes: 0 additions & 210 deletions analyzers/rules/index.mdx

This file was deleted.

Loading
Loading