#!/bin/bash # Zen MCP Server - Code Quality Checks # This script runs all required linting and testing checks before committing changes. # ALL checks must pass 100% for CI/CD to succeed. set -e # Exit on any error echo "๐Ÿ” Running Code Quality Checks for Zen MCP Server" echo "=================================================" # Check if virtual environment is activated if [[ "$VIRTUAL_ENV" == "" ]]; then echo "โŒ Virtual environment not activated!" echo "Please run: source venv/bin/activate" exit 1 fi echo "โœ… Virtual environment detected: $VIRTUAL_ENV" echo "" # Step 1: Linting and Formatting echo "๐Ÿ“‹ Step 1: Running Linting and Formatting Checks" echo "--------------------------------------------------" echo "๐Ÿ”ง Running ruff linting with auto-fix..." ruff check --fix echo "๐ŸŽจ Running black code formatting..." black . echo "๐Ÿ“ฆ Running import sorting with isort..." isort . echo "โœ… Verifying all linting passes..." ruff check echo "โœ… Step 1 Complete: All linting and formatting checks passed!" echo "" # Step 2: Unit Tests echo "๐Ÿงช Step 2: Running Complete Unit Test Suite" echo "---------------------------------------------" echo "๐Ÿƒ Running all 361 unit tests..." python -m pytest tests/ -v echo "โœ… Step 2 Complete: All unit tests passed!" echo "" # Step 3: Final Summary echo "๐ŸŽ‰ All Code Quality Checks Passed!" echo "==================================" echo "โœ… Linting (ruff): PASSED" echo "โœ… Formatting (black): PASSED" echo "โœ… Import sorting (isort): PASSED" echo "โœ… Unit tests (361 tests): PASSED" echo "" echo "๐Ÿš€ Your code is ready for commit and GitHub Actions!" echo "๐Ÿ’ก Remember to add simulator tests if you modified tools"