- Chromium C++ style guide
- Chromium Objective-C style guide
- Java style guide for Android
- GN style guide for build files
Chromium also uses these languages to a lesser degree:
- Kernel C style for ChromiumOS firmware.
- IDL
- Jinja style guide for Jinja templates.
Python code should follow PEP-8.
Some existing scripts were originally written following Google's internal style guideline and have the following two exceptions. New scripts should, however, be PEP-8 compliant.
- Use two-space indentation instead of four-space indentation.
- Use
CamelCase()
method and function names instead ofunix_hacker_style()
names.
Depot tools contains a local copy of pylint, appropriately configured.
Note that asserts are of limited use, and should not be used for validating input – throw an exception instead. Asserts can be used for validating program logic, especially use of interfaces or invariants (e.g., asserting that a function is only called with dictionaries that contain a certain key). See Using Assertions Effectively.
See also the Chromium OS Python Style Guidelines.
When working on Web-based UI features, consult the Web Development Style Guide for the Chromium conventions used in JS/CSS/HTML files.
Internal uses of web languages, notably "layout" tests, should preferably follow these style guides, but it is not enforced.