mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
Split lint workflow into three clearly separated modes: - scripts/format: Python-only formatting (Ruff format) - scripts/lint-fix: Python-only lint auto-fixes (Ruff check --fix) - scripts/lint: convenience wrapper (delegates to format + lint-fix) Add all-in-one scripts covering Python and non-Python files (Prettier for JSON/JSONC/Markdown/YAML, shfmt for shell scripts): - scripts/format-all: format all file types - scripts/check-all: check-only for all file types (CI/CD parity) - scripts/lint-all: format-all + lint-fix in one command Release-Notes: skip User-Impact: none
33 lines
725 B
Bash
Executable file
33 lines
725 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# script/format: Format code with Ruff formatter
|
|
#
|
|
# Runs Ruff format and applies formatting changes. Automatically cleans up any
|
|
# accidental package installations after running.
|
|
#
|
|
# Usage:
|
|
# ./scripts/format
|
|
#
|
|
# Examples:
|
|
# ./scripts/format
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
# shellcheck source=scripts/.lib/output.sh
|
|
source "$SCRIPT_DIR/.lib/output.sh"
|
|
|
|
if [[ -z ${VIRTUAL_ENV:-} ]]; then
|
|
# shellcheck source=/dev/null
|
|
source "$HOME/.venv/bin/activate"
|
|
fi
|
|
|
|
log_header "Running Ruff format"
|
|
uv run --active ruff format .
|
|
|
|
# Clean up any accidental package installation from uv run
|
|
"$SCRIPT_DIR/clean" --minimal
|
|
|
|
log_success "Formatting completed"
|