diff options
author | David Pursehouse <dpursehouse@collab.net> | 2020-02-15 13:51:17 +0900 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-15 23:18:50 +0000 |
commit | d6b8bd464cb032e8180b4219d9821cb3cf8e3d89 (patch) | |
tree | 278f13deabc8bde0c5ad0107b3f79df9a518f3f3 | |
parent | 6a784ff9a6ea025021a33703152c7b2b1becb7fc (diff) | |
download | git-repo-d6b8bd464cb032e8180b4219d9821cb3cf8e3d89.tar.gz |
Reword the documentation regarding coding style
- flake8 is a wrapper around pyflakes, so it's redundant to mention
both of them. Roll the explicit sections about coding errors and
coding style violations into a single section.
- After recent cleanups the project now has zero warnings or errors
from flake8. Reword the requirements so that it is now mandatory
to not introduce new warnings.
- Expand the section on suppression of warnings to differentiate
between suppressing inline individually and globally suppressing
for the whole project.
- Properly capitalize "Python Style Guide".
Change-Id: I4b333d013e985db252873441b16cb719ed5be5b5
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255040
Tested-by: David Pursehouse <dpursehouse@collab.net>
Reviewed-by: Mike Frysinger <vapier@google.com>
-rw-r--r-- | SUBMITTING_PATCHES.md | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/SUBMITTING_PATCHES.md b/SUBMITTING_PATCHES.md index 316cb620..c51fac0b 100644 --- a/SUBMITTING_PATCHES.md +++ b/SUBMITTING_PATCHES.md | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | - Make small logical changes. | 5 | - Make small logical changes. |
6 | - Provide a meaningful commit message. | 6 | - Provide a meaningful commit message. |
7 | - Check for coding errors and style nits with pyflakes and flake8 | 7 | - Check for coding errors and style nits with flake8. |
8 | - Make sure all code is under the Apache License, 2.0. | 8 | - Make sure all code is under the Apache License, 2.0. |
9 | - Publish your changes for review. | 9 | - Publish your changes for review. |
10 | - Make corrections if requested. | 10 | - Make corrections if requested. |
@@ -38,39 +38,30 @@ If your description starts to get too long, that's a sign that you | |||
38 | probably need to split up your commit to finer grained pieces. | 38 | probably need to split up your commit to finer grained pieces. |
39 | 39 | ||
40 | 40 | ||
41 | ## Check for coding errors and style nits with pyflakes and flake8 | 41 | ## Check for coding errors and style violations with flake8 |
42 | 42 | ||
43 | ### Coding errors | 43 | Run `flake8` on changed modules: |
44 | |||
45 | Run `pyflakes` on changed modules: | ||
46 | |||
47 | pyflakes file.py | ||
48 | |||
49 | Ideally there should be no new errors or warnings introduced. | ||
50 | |||
51 | ### Style violations | ||
52 | |||
53 | Run `flake8` on changes modules: | ||
54 | 44 | ||
55 | flake8 file.py | 45 | flake8 file.py |
56 | 46 | ||
57 | Note that repo generally follows [Google's python style guide] rather than | 47 | Note that repo generally follows [Google's Python Style Guide] rather than |
58 | [PEP 8], with a couple of notable exceptions: | 48 | [PEP 8], with a couple of notable exceptions: |
59 | 49 | ||
60 | * Indentation is at 2 columns rather than 4 | 50 | * Indentation is at 2 columns rather than 4 |
61 | * The maximum line length is 100 columns rather than 80 | 51 | * The maximum line length is 100 columns rather than 80 |
62 | 52 | ||
63 | It's possible that the output of `flake8` will be quite noisy, so it's not | 53 | There should be no new errors or warnings introduced. |
64 | mandatory to avoid all warnings, but at least the maximum line length | ||
65 | should be followed. | ||
66 | 54 | ||
67 | If there are many occurrences of the same warning that cannot be | 55 | Warnings that cannot be avoided without going against the Google Style Guide |
68 | avoided without going against the Google style guide, these may be | 56 | may be suppressed inline individally using a `# noqa` comment as described |
69 | suppressed in the included `.flake8` file. | 57 | in the [flake8 documentation]. |
70 | 58 | ||
71 | [Google's python style guide]: https://google.github.io/styleguide/pyguide.html | 59 | If there are many occurrences of the same warning, these may be suppressed for |
72 | [PEP 8]: https://www.python.org/dev/peps/pep-0008/ | 60 | the entire project in the included `.flake8` file. |
73 | 61 | ||
62 | [Google's Python Style Guide]: https://google.github.io/styleguide/pyguide.html | ||
63 | [PEP 8]: https://www.python.org/dev/peps/pep-0008/ | ||
64 | [flake8 documentation]: https://flake8.pycqa.org/en/3.1.1/user/ignoring-errors.html#in-line-ignoring-errors | ||
74 | 65 | ||
75 | ## Running tests | 66 | ## Running tests |
76 | 67 | ||