For other languages, please see the Chromium style guides.
Chromium follows PEP-8 unless an exception is listed below.
See also the Chromium OS Python Style Guidelines.
You can propose changes to this style guide by sending an email to
firstname.lastname@example.org. Ideally, the list will arrive at some consensus and you can request review for a change to this file. If there's no consensus,
//styleguide/python/OWNERS get to decide.
CamelCase()method and function names instead of
(The rationale for these is mostly legacy: the code was originally written following Google's internal style guideline, the cost of updating all of the code to PEP-8 compliance was not small, and consistency was seen to be a greater virtue than compliance.)
Depot tools contains a local copy of pylint, appropriately configured.
YAPF is the Python formatter used by:
git cl format --python
Directories can opt into enforcing auto-formatting by adding a
.style.yapf file with the following contents:
[style] based_on_style = chromium
Entire files can be formatted (rather than just touched lines) via:
git cl format --python --full