Skip to content

Commit 5a10634

Browse files
committed
Add analysis modules for code health and technical debt tracking
1 parent a06de4b commit 5a10634

9 files changed

Lines changed: 1920 additions & 1 deletion

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Code Health Analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
generate-snapshot:
11+
name: Generate Code Health Snapshot
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Full history for git analysis
19+
20+
- name: Install Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Install uv
26+
run: |
27+
curl -LsSf https://astral.sh/uv/install.sh | sh
28+
echo "$HOME/.local/bin" >> $GITHUB_PATH
29+
30+
- name: Install analysis dependencies
31+
working-directory: analysis
32+
run: |
33+
uv pip install --system -r pyproject.toml
34+
35+
- name: Generate snapshot
36+
working-directory: analysis
37+
run: |
38+
python snapshot.py --output ../analysis-snapshot.json
39+
40+
- name: Upload snapshot artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: code-health-snapshot-${{ github.sha }}
44+
path: analysis-snapshot.json
45+
retention-days: 90
46+
if-no-files-found: error
47+
48+
- name: Print summary
49+
run: |
50+
echo "## Code Health Snapshot Generated" >> $GITHUB_STEP_SUMMARY
51+
echo "" >> $GITHUB_STEP_SUMMARY
52+
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
53+
echo "" >> $GITHUB_STEP_SUMMARY
54+
echo "### Summary Metrics" >> $GITHUB_STEP_SUMMARY
55+
echo "" >> $GITHUB_STEP_SUMMARY
56+
jq -r '.summary | to_entries | .[] | "- **\(.key):** \(.value)"' analysis-snapshot.json >> $GITHUB_STEP_SUMMARY
57+
echo "" >> $GITHUB_STEP_SUMMARY
58+
echo "### Top Priority Hotspots" >> $GITHUB_STEP_SUMMARY
59+
echo "" >> $GITHUB_STEP_SUMMARY
60+
echo "| File | Changes | Complexity | Priority Score |" >> $GITHUB_STEP_SUMMARY
61+
echo "|------|---------|------------|----------------|" >> $GITHUB_STEP_SUMMARY
62+
jq -r '.priority_hotspots[:5] | .[] | "| \(.path) | \(.change_count) | \(.max_complexity) | \(.priority_score) |"' analysis-snapshot.json >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ node_modules
88
**/__pycache__/
99

1010
# Folder for storing AI generated artifacts
11-
ai-artifacts/*
11+
ai-artifacts/*
12+
13+
# Code health analysis snapshots (generated, uploaded as artifacts)
14+
analysis-snapshot.json

analysis/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
"""Code health analysis tools for tracking technical debt."""

0 commit comments

Comments
 (0)