|
| 1 | +# Use Google Python style guide with minimal refinements |
| 2 | + |
| 3 | +Technical Story: https://github.com/theupdateframework/tuf/issues/1128 |
| 4 | + |
| 5 | +## Context and Problem Statement |
| 6 | + |
| 7 | +The Secure Systems Lab code style guide, which has been used for most of the |
| 8 | +code base, has become outdated. Through the upcoming rewrite, we have the |
| 9 | +chance to ignore consistency considerations with existing code style and can |
| 10 | +choose a more standard and up-to-date style guide. |
| 11 | + |
| 12 | +## Decision Drivers |
| 13 | + |
| 14 | +* Flaws in original Secure Systems Lab style guide |
| 15 | +* Curating a complete custom style guide is time consuming |
| 16 | +* Well-established style rules lower contribution barrier |
| 17 | +* Custom style is not supported by default in common tooling (i.e. editors |
| 18 | + and linters) |
| 19 | + |
| 20 | +## Considered Options |
| 21 | + |
| 22 | +* Use custom style guide |
| 23 | +* Use Google style guide with refinements |
| 24 | + |
| 25 | +## Decision Outcome |
| 26 | + |
| 27 | +Chosen option: "Use Google style guide with refinements", because the Google |
| 28 | +style guide is a comprehensive, well-established style guide that is mostly |
| 29 | +based on PEP-8 and was accepted by everyone on the TUF team. There is no need |
| 30 | +to replicate these recommendations. However, we do provide a very slim document |
| 31 | +with additional refinements, in order to emphasize items the we consider |
| 32 | +especially important, want to be handled differently, or in one specific way, |
| 33 | +where the Google guide would allow multiple. |
| 34 | + |
| 35 | +**Course of Action:** |
| 36 | +* Follow existing style when working on existing code (files) |
| 37 | +* Follow new style in any new code (files) |
| 38 | +* Consider providing linter and formatter configuration (e.g. pylint, flake8, |
| 39 | + black, yapf) to enforce and facilitate new style |
| 40 | + |
| 41 | + |
| 42 | +## Links |
| 43 | +* [New Slim Secure Systems Lab style guide](https://github.com/secure-systems-lab/code-style-guidelines/pull/21) |
| 44 | +* [Google Python style guide](https://google.github.io/styleguide/pyguide.html) |
| 45 | +* [PEP 8](https://www.python.org/dev/peps/pep-0008/) |
| 46 | +* [Issues in original Secure Systems Lab style guide](https://github.com/secure-systems-lab/code-style-guidelines/issues/20) |
0 commit comments