Add information about black and mypy.

Dan Albert 2021-05-10 18:12:18 -07:00
parent ab44a043d6
commit 38a2d8fe93

@ -66,6 +66,22 @@ You can run DCS Liberation from source with this configuration: (Adapt it to you
![](https://imgur.com/oXRAZpz.png)
## Type checkers and linters
We use [black](https://github.com/psf/black) for auto-formatting. The pre-commit hook will automatically run the formatter when you make a commit. See their docs for instructions on configuring black to run in your editor.
We use [mypy](https://mypy.readthedocs.io/en/stable/) for type checking. Python has built-in support for type annotations but does not perform any checking; that work is delegated to tools like mypy. All new code should include type annotations, and it's generally a good idea to add type annotations to any function you touch.
To check for type errors, run:
```
mypy game gen
```
This only checks the `game` and `gen` packages. `qt_ui` will probably never be checkable because `PySide2` (the Python Qt API) contains many patterns that do not play well with the type checker, but it's good to add the annotations anyway as they help the reader.
The type checker is **not** run as part of pre-commit, since that makes it harder to create WIP commits, but is run as a part of the PR and build checks, so it's best to run before uploading a PR, and definitely should be run before a push to develop.
## Making a release
https://github.com/Khopa/dcs_liberation/wiki/Release-process