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

Side by Side Diff: styleguide/styleguide.md

Issue 2819823002: Revert of Update Python style guide to point out exceptions only apply to legacy scripts (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | 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
1 # Chromium coding style 1 # Chromium coding style
2 2
3 ## Main style guides 3 ## Main style guides
4 4
5 * [Chromium C++ style guide](c++/c++.md) 5 * [Chromium C++ style guide](c++/c++.md)
6 * [Google Objective-C style guide](https://google.github.io/styleguide/objcgui de.xml) 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) 7 * [Java style guide for Android](https://sites.google.com/a/chromium.org/dev/d evelopers/coding-style/java)
8 * [GN style guide](../tools/gn/docs/style_guide.md) for build files 8 * [GN style guide](../tools/gn/docs/style_guide.md) for build files
9 9
10 Chromium also uses these languages to a lesser degree: 10 Chromium also uses these languages to a lesser degree:
11 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. 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) 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. 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 15
16 ## Python 16 ## Python
17 17
18 Python code should follow [PEP-8](https://www.python.org/dev/peps/pep-0008/). 18 Python code should follow [PEP-8](https://www.python.org/dev/peps/pep-0008/),
19 19 except:
20 Some existing scripts were originally written following Google's internal
21 style guideline and have the following two exceptions. New scripts should,
22 however, be PEP-8 compliant.
23 20
24 * Use two-space indentation instead of four-space indentation. 21 * Use two-space indentation instead of four-space indentation.
25 * Use `CamelCase()` method and function names instead of `unix_hacker_style()` names. 22 * Use `CamelCase()` method and function names instead of `unix_hacker_style()` names.
26 23
24 (The rationale for these is mostly legacy: the code was originally written
25 following Google's internal style guideline, the cost of updating all of the
26 code to PEP-8 compliance was not small, and consistency was seen to be a
27 greater virtue than compliance.)
28
27 [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/dep ot_tools/docs/html/depot_tools.html) 29 [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/dep ot_tools/docs/html/depot_tools.html)
28 contains a local copy of pylint, appropriately configured. 30 contains a local copy of pylint, appropriately configured.
29 31
30 Note that asserts are of limited use, and should not be used for validating 32 Note that asserts are of limited use, and should not be used for validating
31 input – throw an exception instead. Asserts can be used for validating program 33 input – throw an exception instead. Asserts can be used for validating program
32 logic, especially use of interfaces or invariants (e.g., asserting that a 34 logic, especially use of interfaces or invariants (e.g., asserting that a
33 function is only called with dictionaries that contain a certain key). [See 35 function is only called with dictionaries that contain a certain key). [See
34 Using Assertions 36 Using Assertions
35 Effectively](https://wiki.python.org/moin/UsingAssertionsEffectively). 37 Effectively](https://wiki.python.org/moin/UsingAssertionsEffectively).
36 38
37 See also the [Chromium OS Python Style 39 See also the [Chromium OS Python Style
38 Guidelines](https://sites.google.com/a/chromium.org/dev/chromium-os/python-style -guidelines). 40 Guidelines](https://sites.google.com/a/chromium.org/dev/chromium-os/python-style -guidelines).
39 41
40 ## Web languages (JavaScript, HTML, CSS) 42 ## Web languages (JavaScript, HTML, CSS)
41 43
42 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. 44 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.
43 45
44 Internal uses of web languages, notably "layout" tests, should preferably follow these style guides, but it is not enforced. 46 Internal uses of web languages, notably "layout" tests, should preferably follow these style guides, but it is not enforced.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698