Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: styleguide/styleguide.md

Issue 2127713004: Add C++ style guide to repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« styleguide/c++/c++.md ('K') | « styleguide/c++/c++.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Chromium coding style
2
3 ## Main style guides
4
5 * [Chromium C++ style guide](https://chromium.googlesource.com/chromium/src/+/ master/styleguide/c++/c++.md)
jbroman 2016/07/06 19:38:03 Since this file is also in this repo, shouldn't a
6 * [Google Objective-C style guide](https://google.github.io/styleguide/objcgui de.xml)
7 * [Java style guide for Android](https://sites.google.com/a/chromium.org/dev/d evelopers/coding-style/java)
8 * [GN style guide](https://chromium.googlesource.com/chromium/src/+/master/too l) for build files
9
10 Chromium also uses these languages to a lesser degree:
11
12 * [Kernel C style](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux .git/tree/Documentation/CodingStyle?id=refs/heads/master) for ChromiumOS firmwar e.
13 * [IDL](https://sites.google.com/a/chromium.org/dev/blink/webidl#TOC-Style)
14 * [Jinja style guide](https://sites.google.com/a/chromium.org/dev/developers/j inja#TOC-Style) for [Jinja](https://sites.google.com/a/chromium.org/dev/develope rs/jinja) templates.
15
16 ## Python
17
18 Python code should follow [PEP-8](https://www.python.org/dev/peps/pep-0008/),
19 except:
20
21 * Use two-space indentation instead of four-space indentation.
22 * Use `CamelCase()` method and function names instead of
23 * `unix_hacker_style()` names.
24
25 (The rationale for these is mostly legacy: the code was originally written
26 following Google's internal style guideline, the cost of updating all of the
27 code to PEP-8 compliance was not small, and consistency was seen to be a
28 greater virtue than compliance.)
29
30 [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/dep ot_tools/docs/html/depot_tools.html)
31 contains a local copy of pylint, appropriately configured.
32
33 Note that asserts are of limited use, and should not be used for validating
34 input – throw an exception instead. Asserts can be used for validating program
35 logic, especially use of interfaces or invariants (e.g., asserting that a
36 function is only called with dictionaries that contain a certain key). [See
37 Using Assertions
38 Effectively](https://wiki.python.org/moin/UsingAssertionsEffectively).
39
40 See also the [Chromium OS Python Style
41 Guidelines](https://sites.google.com/a/chromium.org/dev/chromium-os/python-style -guidelines).
42
43 ## Web langauges (JavaScript, HTML, CSS)
jbroman 2016/07/06 19:38:03 spelling: "languages"
44
45 When working on Web-based UI features, consult the [Web Development Style Guide] (https://sites.google.com/a/chromium.org/dev/developers/web-development-style-gu ide) for the Chromium conventions used in JS/CSS/HTML files.
46
47 Internal uses of web languages, notably "layout" tests, should preferably follow these style guides, but it is not enforced.
OLDNEW
« styleguide/c++/c++.md ('K') | « styleguide/c++/c++.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698