Formatting¶
The arpoon
library uses Ruff for static analysis, linting, and code
formatting.
Install¶
First, ruff
needs to be installed on your system. Easily install it by installing the development dependencies.
$ python3 -m pip install -r requirements-dev.txt
Configuration¶
The ruff
configuration is provided in pyproject.toml
.
Run the linter¶
Run the Ruff linter manually from the command line.
$ python3 -m ruff check .
Run the formatter¶
Run the Ruff formatter manually from the command line.
$ python3 -m ruff format --check .
Pre-commit¶
A pre-commit
configuration file with various hooks is provided in .pre-commit-config.yaml
.
Enable pre-commit
by installing the pre-commit hooks.
$ pre-commit install
Run pre-commit
on all files.
$ pre-commit run --all-files
Disable pre-commit
by uninstalling the pre-commit hooks.
$ pre-commit uninstall
Run from VS Code¶
Install the Ruff extension for VS Code.
Included is a VS Code configuration file .vscode/settings.json
.
VS Code will run the linter and formatter as you view and edit files.
Last update:
May 06, 2024