add pre-commits/linters for better code

Author: LittlePlanetoidCreated Jun 27, 2026Updated Jun 27, 2026
  1. uv add --dev pre-commit
  2. uv run pre-commit install
  3. touch .pre-commit-config.yaml

here is a pre-commit conf example which use Ruff and Shellcheck linters (python and bash):

repos: - repo: local hooks: - id: ruff-format-diff name: ruff format diff language: system entry: uv run ruff format --diff types: [python] - id: ruff-check name: ruff check language: system entry: uv run ruff check - id: shellcheck name: run shellcheck language: system entry: shellcheck files: .(sh.j2|sh)$

At each git commit attempt, linters will check commited code and validate or not the commit

Source: originalankur/maptoposter