xref: /aosp_15_r20/external/google-styleguide/README.md (revision 8c35d5ee8e2913d4bd6623e2b93232b1da0ab719)
1*8c35d5eeSXin LiGoogle Style Guides
2*8c35d5eeSXin Li===================
3*8c35d5eeSXin Li
4*8c35d5eeSXin LiEvery major open-source project has its own style guide: a set of conventions
5*8c35d5eeSXin Li(sometimes arbitrary) about how to write code for that project. It is much
6*8c35d5eeSXin Lieasier to understand a large codebase when all the code in it is in a
7*8c35d5eeSXin Liconsistent style.
8*8c35d5eeSXin Li
9*8c35d5eeSXin Li“Style” covers a lot of ground, from “use camelCase for variable names” to
10*8c35d5eeSXin Li“never use global variables” to “never use exceptions.” This project
11*8c35d5eeSXin Li([google/styleguide](https://github.com/google/styleguide)) links to the
12*8c35d5eeSXin Listyle guidelines we use for Google code. If you are modifying a project that
13*8c35d5eeSXin Lioriginated at Google, you may be pointed to this page to see the style guides
14*8c35d5eeSXin Lithat apply to that project.
15*8c35d5eeSXin Li
16*8c35d5eeSXin LiThis project holds the [C++ Style Guide][cpp], [Objective-C Style Guide][objc],
17*8c35d5eeSXin Li[Java Style Guide][java], [Python Style Guide][py], [R Style Guide][r],
18*8c35d5eeSXin Li[Shell Style Guide][sh], [HTML/CSS Style Guide][htmlcss],
19*8c35d5eeSXin Li[JavaScript Style Guide][js], [AngularJS Style Guide][angular],
20*8c35d5eeSXin Li[Common Lisp Style Guide][cl], and [Vimscript Style Guide][vim]. This project
21*8c35d5eeSXin Lialso contains [cpplint][cpplint], a tool to assist with style guide compliance,
22*8c35d5eeSXin Liand [google-c-style.el][emacs], an Emacs settings file for Google style.
23*8c35d5eeSXin Li
24*8c35d5eeSXin LiIf your project requires that you create a new XML document format, the [XML
25*8c35d5eeSXin LiDocument Format Style Guide][xml] may be helpful. In addition to actual style
26*8c35d5eeSXin Lirules, it also contains advice on designing your own vs. adapting an existing
27*8c35d5eeSXin Liformat, on XML instance document formatting, and on elements vs. attributes.
28*8c35d5eeSXin Li
29*8c35d5eeSXin LiThe style guides in this project are licensed under the CC-By 3.0 License,
30*8c35d5eeSXin Liwhich encourages you to share these documents.
31*8c35d5eeSXin LiSee [https://creativecommons.org/licenses/by/3.0/][ccl] for more details.
32*8c35d5eeSXin Li
33*8c35d5eeSXin LiThe following Google style guides live outside of this project:
34*8c35d5eeSXin Li[Go Code Review Comments][go] and [Effective Dart][dart].
35*8c35d5eeSXin Li
36*8c35d5eeSXin Li<a rel="license" href="https://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" /></a>
37*8c35d5eeSXin Li
38*8c35d5eeSXin Li[cpp]: https://google.github.io/styleguide/cppguide.html
39*8c35d5eeSXin Li[objc]: objcguide.md
40*8c35d5eeSXin Li[java]: https://google.github.io/styleguide/javaguide.html
41*8c35d5eeSXin Li[py]: https://google.github.io/styleguide/pyguide.html
42*8c35d5eeSXin Li[r]: https://google.github.io/styleguide/Rguide.html
43*8c35d5eeSXin Li[sh]: https://google.github.io/styleguide/shell.xml
44*8c35d5eeSXin Li[htmlcss]: https://google.github.io/styleguide/htmlcssguide.html
45*8c35d5eeSXin Li[js]: https://google.github.io/styleguide/jsguide.html
46*8c35d5eeSXin Li[angular]: https://google.github.io/styleguide/angularjs-google-style.html
47*8c35d5eeSXin Li[cl]: https://google.github.io/styleguide/lispguide.xml
48*8c35d5eeSXin Li[vim]: https://google.github.io/styleguide/vimscriptguide.xml
49*8c35d5eeSXin Li[cpplint]: https://github.com/google/styleguide/tree/gh-pages/cpplint
50*8c35d5eeSXin Li[emacs]: https://raw.githubusercontent.com/google/styleguide/gh-pages/google-c-style.el
51*8c35d5eeSXin Li[xml]: https://google.github.io/styleguide/xmlstyle.html
52*8c35d5eeSXin Li[go]: https://golang.org/wiki/CodeReviewComments
53*8c35d5eeSXin Li[dart]: https://www.dartlang.org/guides/language/effective-dart
54*8c35d5eeSXin Li[ccl]: https://creativecommons.org/licenses/by/3.0/
55