#!/bin/bash # Run Ruff linter in check mode echo "Running Ruff linter..." ruff check . # Check if linting failed if [ $? -ne 0 ]; then echo "Linting failed. Attempting to fix automatically..." ruff check --fix . # Check if auto-fixing resolved all issues if [ $? -ne 0 ]; then echo "Some issues could not be fixed automatically. Please fix them manually." exit 1 else echo "Auto-fixing succeeded!" fi fi # Run Ruff formatter echo "Running Ruff formatter..." ruff format . echo "Linting and formatting completed successfully!"