docs: add code quality and type checking workflows to master index
Some checks failed
Documentation Validation / validate-docs (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
CLI Tests / test-cli (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-sdk-js path:packages/js/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Systemd Sync / sync-systemd (push) Has been cancelled
Some checks failed
Documentation Validation / validate-docs (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
CLI Tests / test-cli (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-sdk-js path:packages/js/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Systemd Sync / sync-systemd (push) Has been cancelled
- Add Code Quality Module section with pre-commit hooks and quality checks - Add Type Checking CI/CD Module section with MyPy workflow and coverage - Update README with code quality achievements and project structure - Migrate FastAPI apps from deprecated on_event to lifespan context manager - Update pyproject.toml files to reference consolidated dependencies - Remove unused app.py import in coordinator-api - Add type hints to agent
This commit is contained in:
100
scripts/type-checking/check-coverage.sh
Executable file
100
scripts/type-checking/check-coverage.sh
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/bin/bash
|
||||
# Type checking coverage script for AITBC
|
||||
# Measures and reports type checking coverage
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Main directory
|
||||
AITBC_ROOT="/opt/aitbc"
|
||||
cd "$AITBC_ROOT"
|
||||
|
||||
# Check if mypy is available
|
||||
if ! command -v ./venv/bin/mypy &> /dev/null; then
|
||||
log_error "mypy not found. Please install with: pip install mypy"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "Running type checking coverage analysis..."
|
||||
|
||||
# Count total Python files
|
||||
TOTAL_FILES=$(find apps/coordinator-api/src/app -name "*.py" | wc -l)
|
||||
log_info "Total Python files: $TOTAL_FILES"
|
||||
|
||||
# Check core domain files (should pass)
|
||||
CORE_DOMAIN_FILES=(
|
||||
"apps/coordinator-api/src/app/domain/job.py"
|
||||
"apps/coordinator-api/src/app/domain/miner.py"
|
||||
"apps/coordinator-api/src/app/domain/agent_portfolio.py"
|
||||
)
|
||||
|
||||
CORE_PASSING=0
|
||||
CORE_TOTAL=${#CORE_DOMAIN_FILES[@]}
|
||||
|
||||
for file in "${CORE_DOMAIN_FILES[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
if ./venv/bin/mypy --ignore-missing-imports "$file" > /dev/null 2>&1; then
|
||||
((CORE_PASSING++))
|
||||
log_success "✓ $file"
|
||||
else
|
||||
log_error "✗ $file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Check entire domain directory
|
||||
DOMAIN_ERRORS=0
|
||||
if ./venv/bin/mypy --ignore-missing-imports apps/coordinator-api/src/app/domain/ > /dev/null 2>&1; then
|
||||
log_success "Domain directory: PASSED"
|
||||
else
|
||||
DOMAIN_ERRORS=$(./venv/bin/mypy --ignore-missing-imports apps/coordinator-api/src/app/domain/ 2>&1 | grep -c "error:" || echo "0")
|
||||
log_warning "Domain directory: $DOMAIN_ERRORS errors"
|
||||
fi
|
||||
|
||||
# Calculate coverage percentages
|
||||
CORE_COVERAGE=$((CORE_PASSING * 100 / CORE_TOTAL))
|
||||
DOMAIN_COVERAGE=$(( (TOTAL_FILES - DOMAIN_ERRORS) * 100 / TOTAL_FILES ))
|
||||
|
||||
# Report results
|
||||
echo ""
|
||||
log_info "=== Type Checking Coverage Report ==="
|
||||
echo "Core Domain Files: $CORE_PASSING/$CORE_TOTAL ($CORE_COVERAGE%)"
|
||||
echo "Overall Coverage: $((TOTAL_FILES - DOMAIN_ERRORS))/$TOTAL_FILES ($DOMAIN_COVERAGE%)"
|
||||
echo ""
|
||||
|
||||
# Set exit code based on coverage thresholds
|
||||
THRESHOLD=80
|
||||
|
||||
if [ $CORE_COVERAGE -lt $THRESHOLD ]; then
|
||||
log_error "Core domain coverage below ${THRESHOLD}%: ${CORE_COVERAGE}%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $DOMAIN_COVERAGE -lt $THRESHOLD ]; then
|
||||
log_warning "Overall coverage below ${THRESHOLD}%: ${DOMAIN_COVERAGE}%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_success "Type checking coverage meets thresholds (≥${THRESHOLD}%)"
|
||||
Reference in New Issue
Block a user