1
0
Fork 0

Make black with line length 80 repo's code style

Provide a consistent formatting style and tox commands to lint and
format.

Bug: b/267675342
Change-Id: I33ddfe07af8473f4334c347d156246bfb66d4cfe
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/362954
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak 2023-03-11 04:35:22 +00:00 committed by LUCI
parent 75eb8ea935
commit 1604cf255f
4 changed files with 58 additions and 19 deletions

View file

@ -4,7 +4,6 @@
- Make small logical changes.
- [Provide a meaningful commit message][commit-message-style].
- Check for coding errors and style nits with flake8.
- Make sure all code is under the Apache License, 2.0.
- Publish your changes for review.
- Make corrections if requested.
@ -39,17 +38,26 @@ If your description starts to get too long, that's a sign that you
probably need to split up your commit to finer grained pieces.
## Check for coding errors and style violations with flake8
## Linting and formatting code
Run `flake8` on changed modules:
Lint any changes by running:
```sh
$ tox -e lint -- file.py
```
flake8 file.py
And format with:
```sh
$ tox -e format -- file.py
```
Note that repo generally follows [Google's Python Style Guide] rather than
[PEP 8], with a couple of notable exceptions:
Or format everything:
```sh
$ tox -e format
```
* Indentation is at 2 columns rather than 4
* The maximum line length is 100 columns rather than 80
Repo uses [black](https://black.readthedocs.io/) with line length of 80 as its
formatter and flake8 as its linter. Repo also follows
[Google's Python Style Guide].
There should be no new errors or warnings introduced.