Expand description
Optional checks for file types other than Rust source
Handles python tool version management via a virtual environment in
build/venv.
Β§Functional outline
- Run tidy with an extra option: --extra-checks=py,shell,--extra-checks=py:lint, or similar. Optionally provide specific configuration after a double dash (--extra-checks=py -- foo.py)
- Build configuration based on args/environment:
- Formatters by default are in check only mode
- If in CI (TIDY_PRINT_DIFF=1 is set), check and print the diff
- If --blessis provided, formatters may run
- Pass any additional config after the --. If no files are specified, use a default.
 
- Print the output of the given command. If it fails and TIDY_PRINT_DIFFis set, rerun the tool to print a suggestion diff (for e.g. CI)
StructsΒ§
- ExtraCheck πArg 
EnumsΒ§
- Error π
- ExtraCheck πKind 
- ExtraCheck πLang 
- ExtraCheck πParse Error 
ConstantsΒ§
- MIN_PY_ πREV 
- MIN_PY_ πREV_ STR 
- PIP_REQ_ πPATH 
- REL_PY_ πPATH 
- RUFF_CACHE_ πPATH 
- Location within build directory
- RUFF_CONFIG_ πPATH 
- SPELLCHECK_DIRS π
FunctionsΒ§
- check
- check_impl π
- create_venv_ πat_ path 
- Attempt to create a virtualenv at this path. Cycles through all expected valid python versions to find one that is installed.
- find_with_ πextension 
- Check git for tracked files matching an extension
- get_or_ πcreate_ venv 
- Create a virtuaenv at a given path if it doesnβt already exist, or validate the install if it does. Returns the path to that venvβs python executable.
- install_requirements π
- merge_args π
- Helper to create cfg1 cfg2 -- file1 file2output
- py_runner π
- Run a python command with given arguments. py_pathshould be a virtualenv.
- run_ruff π
- shellcheck_runner π
- Check that shellcheck is installed then run it at the given path
- spellcheck_runner π
- Check that spellchecker is installed then run it at the given path
- try_create_ πvenv 
- verify_py_ πversion 
- Parse pythonβs version output (Python x.y.z) and ensure we have a suitable version.