33[ ![ PyPI] ( https://img.shields.io/pypi/v/pyls-black.svg )] ( https://pypi.org/project/python-lsp-black ) [ ![ Code style: black] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/ambv/black )
44[ ![ Python] ( https://github.com/python-lsp/python-lsp-black/actions/workflows/python.yml/badge.svg )] ( https://github.com/python-lsp/python-lsp-black/actions/workflows/python.yml )
55
6-
76> [ Black] ( https://github.com/ambv/black ) plugin for the [ Python LSP Server] ( https://github.com/python-lsp/python-lsp-server ) .
87
98## Install
@@ -18,11 +17,11 @@ pip install python-lsp-black
1817
1918To avoid unexpected results you should make sure ` yapf ` and ` autopep8 ` are not installed.
2019
21- * ` python-lsp-black ` can either format an entire file or just the selected text.
22- * The code will only be formatted if it is syntactically valid Python.
23- * Text selections are treated as if they were a separate Python file.
20+ - ` python-lsp-black ` can either format an entire file or just the selected text.
21+ - The code will only be formatted if it is syntactically valid Python.
22+ - Text selections are treated as if they were a separate Python file.
2423 Unfortunately this means you can't format an indented block of code.
25- * ` python-lsp-black ` will use your project's [ pyproject.toml] ( https://github.com/ambv/black#pyprojecttoml ) if it has one.
24+ - ` python-lsp-black ` will use your project's [ pyproject.toml] ( https://github.com/ambv/black#pyprojecttoml ) if it has one.
2625
2726# Development
2827
@@ -34,14 +33,30 @@ python -m venv .venv
3433pip install -e .[dev]
3534```
3635
36+ This project uses [ pre-commit] ( https://pre-commit.com/ ) hooks to control code quality,
37+ install them to run them when creating a git commit, thus avoiding seeing errors when you
38+ create a pull request:
39+
40+ ``` shell
41+ pre-commit install
42+ ```
43+
3744To run tests:
3845
3946``` shell
4047make test
4148```
4249
43- To run linters (flake8, black, isort, mypy...)
50+ To run linters:
51+
52+ ``` shell
53+ make lint # just a shortcut to pre-commit run -a
54+ make < linter_name> # black, flake8, isort, mypy
55+ ```
56+
57+ To upgrade the version of the pre-commit hooks:
4458
4559``` shell
46- make lint
60+ pre-commit autoupdate
61+ # check and git commit changes to .pre-commit-config.yaml
4762```
0 commit comments