Skip to main content
Glama
quality-check.shโ€ข3.29 kB
#!/bin/bash # Quality check script for development and CI set -e # Colors BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' GREEN='\033[0;32m' CYAN='\033[0;36m' NC='\033[0m' # No Color # Parse arguments STRICT=false FIX=false TYPECHECK=false ALL=false while [[ $# -gt 0 ]]; do case $1 in --strict) STRICT=true shift ;; --fix) FIX=true shift ;; --type-check) TYPECHECK=true shift ;; --all) ALL=true shift ;; *) echo "Unknown option: $1" echo "Usage: $0 [--strict] [--fix] [--type-check] [--all]" exit 1 ;; esac done echo -e "${BLUE}๐Ÿ” Running code quality checks...${NC}" exit_code=0 if [[ "$FIX" == "true" || "$ALL" == "true" ]]; then echo -e "\n${YELLOW}๐Ÿ“ Running Ruff formatter...${NC}" uv run ruff format src tests || exit_code=$? echo -e "\n${YELLOW}๐Ÿ”ง Running Ruff linter with auto-fix...${NC}" uv run ruff check src tests --fix || exit_code=$? fi if [[ "$TYPECHECK" == "true" || "$ALL" == "true" || "$STRICT" == "true" ]]; then echo -e "\n${YELLOW}๐Ÿ” Running MyPy type checking...${NC}" if [[ "$STRICT" == "true" ]]; then if uv run mypy src --strict --ignore-missing-imports --show-error-codes; then echo -e "${GREEN}โœ… MyPy type checking passed${NC}" else mypy_exit=$? exit_code=$mypy_exit echo -e "${RED}โŒ MyPy type checking failed in strict mode${NC}" fi else if uv run mypy src --ignore-missing-imports --show-error-codes; then echo -e "${GREEN}โœ… MyPy type checking passed${NC}" else echo -e "${YELLOW}โš ๏ธ MyPy found type issues (non-blocking in development)${NC}" fi fi fi if [[ "$FIX" != "true" && "$TYPECHECK" != "true" ]]; then # Default: just run basic checks echo -e "\n${YELLOW}๐Ÿ”ง Running Ruff linter...${NC}" uv run ruff check src tests || exit_code=$? fi # Run pre-commit hooks if available if [[ -f ".pre-commit-config.yaml" ]]; then if [[ "$STRICT" == "true" ]]; then echo -e "\n${YELLOW}๐Ÿ”’ Running strict pre-commit checks...${NC}" if [[ -f ".pre-commit-config-strict.yaml" ]]; then uv run pre-commit run --config .pre-commit-config-strict.yaml --all-files || exit_code=$? else uv run pre-commit run --all-files || exit_code=$? fi else echo -e "\n${YELLOW}๐Ÿ”„ Running development pre-commit checks...${NC}" uv run pre-commit run --all-files || true # Don't fail in development mode fi fi # Summary echo -e "\n${BLUE}==================================================${NC}" if [[ $exit_code -eq 0 ]]; then echo -e "${GREEN}โœ… All quality checks passed!${NC}" if [[ "$STRICT" != "true" ]]; then echo -e "${CYAN}๐Ÿ’ก Run with --strict flag for production-ready checks${NC}" fi else echo -e "${RED}โŒ Some quality checks failed (exit code: $exit_code)${NC}" echo -e "${CYAN}๐Ÿ’ก Run with --fix flag to auto-fix issues${NC}" fi echo -e "${BLUE}==================================================${NC}" exit $exit_code

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/washyu/mcp_python_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server