Style guides for Google-originated open-source projects
Go to file
Igor Murashkin 8a87a46cc7 CPPLINT.cfg root=setting is now relative to CFG file.
Also further improve the documentation and testing around --root.

Previously the root=setting in the CFG file was treated identically
to passing --root=setting on the command line, which seems undesirable
since it depends on were cpplint.cfg was invoked from (for relative
paths).

Judging on settings such as 'exclude_files' it seems within the spirit
to make the settings 'current working directory' contextual to the
same directory that CPPLINT.cfg is in.

This also makes execution consistent (picking up the "correct" settings)
regardless of the CWD when executing cpplint.py.

Example:

  echo 'root=..' >> /a/b/c/CPPLINT.cfg
  cd /
  cpplint.py /a/b/c/source_file.h
  # expects header guard of C_SOURCE_FILE_H_

However the old behavior would use '/../' = '/'
and incorrectly think the root was 'A_B_C_SOURCE_FILE_H_'.
2017-11-09 16:36:27 -08:00
cpplint CPPLINT.cfg root=setting is now relative to CFG file. 2017-11-09 16:36:27 -08:00
docguide Replaced HTTP where HTTPS been awailable. 2016-04-01 21:41:34 +13:00
include Update and replace JavaScript style guide. 2016-11-17 18:02:23 -08:00
angularjs-google-style.html Update and replace JavaScript style guide. 2016-11-17 18:02:23 -08:00
cppguide.html Fix a typo 2016-12-31 13:10:07 +08:00
cppguide.xml Update C++ style guide to 4.45. 2014-09-08 17:01:51 +00:00
eclipse-cpp-google-style.xml Add Google C++ Eclipse style config. 2012-06-29 19:26:15 +00:00
eclipse-java-google-style.xml Update eclipse-java-google-style (#271) 2017-09-05 15:27:04 -07:00
google_python_style.vim New file google_python_style.vim. 2010-11-29 20:32:06 +00:00
google-c-style.el Add autoload magic comments for the functions exposed by google-c-style. 2014-09-29 18:18:46 +00:00
google-r-style.html Restore redirect to Rguide.xml from r105. 2013-07-18 23:57:39 +00:00
htmlcssguide.html Fix HTML validation warnings and make the style guide HTML more compliant. 2017-02-27 08:16:24 +00:00
htmlcssguide.xml Move, update, and convert HTML/CSS Style Guide from XML to HTML. (#232) 2017-02-24 12:31:41 +00:00
intellij-java-google-style.xml Update intellij-java-google-style.xml 2017-09-07 11:59:01 -07:00
javaguide.css Updated Java Style Guide to reflect current internal version. 2016-06-29 19:36:05 -04:00
javaguide.html Update Java style guide 2017-09-29 17:19:34 -07:00
javaguidelink.png initial commit for java style guide 2013-12-17 22:56:22 +00:00
javascriptguide.xml Restore ES5 styleguide 2016-12-22 12:06:27 -08:00
jsguide.html Fixed a typo. 2017-06-29 22:16:49 -04:00
jsoncstyleguide_example_01.png Adding first iteration of the JSON-C Style Guide for JSON APIs 2010-02-22 22:39:56 +00:00
jsoncstyleguide_example_02.png Adding first iteration of the JSON-C Style Guide for JSON APIs 2010-02-22 22:39:56 +00:00
jsoncstyleguide.html Update look and feel of the style guides 2010-07-12 21:58:39 +00:00
jsoncstyleguide.xml Replaced HTTP where HTTPS been awailable. 2016-04-01 21:41:34 +13:00
lispguide.xml Fix a typo 2017-09-05 15:22:44 -07:00
objcguide.md [objc] Update the Objective-C style guide 📜 2017-10-16 18:11:48 -07:00
objcguide.xml [objc] Fix the link to the new Objective-C style guide ⛓ 2017-08-24 17:48:51 -07:00
pyguide.html Revert HTTPS changes 2016-07-08 13:25:17 -07:00
README.md Update link to Objective-C style guide 2017-08-22 18:16:59 -04:00
Rguide.xml Reverted XML namespace name changes 2016-04-28 19:25:32 +02:00
shell.xml Fix broken link 2017-05-26 15:45:00 -04:00
styleguide.css Update look and feel of the style guides 2010-07-12 21:58:39 +00:00
styleguide.xsl Reverted XML namespace name changes 2016-04-28 19:25:32 +02:00
vimscriptfull.xml Removed link shortening. 2016-04-01 21:36:44 +13:00
vimscriptguide.xml Removed link shortening. 2016-04-01 21:36:44 +13:00
xmlstyle.html Replaced HTTP where HTTPS been awailable. 2016-04-01 21:41:34 +13:00

Google Style Guides

Every major open-source project has its own style guide: a set of conventions (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a consistent style.

“Style” covers a lot of ground, from “use camelCase for variable names” to “never use global variables” to “never use exceptions.” This project (google/styleguide) links to the style guidelines we use for Google code. If you are modifying a project that originated at Google, you may be pointed to this page to see the style guides that apply to that project.

This project holds the C++ Style Guide, Objective-C Style Guide, Java Style Guide, Python Style Guide, R Style Guide, Shell Style Guide, HTML/CSS Style Guide, JavaScript Style Guide, AngularJS Style Guide, Common Lisp Style Guide, and Vimscript Style Guide. This project also contains cpplint, a tool to assist with style guide compliance, and google-c-style.el, an Emacs settings file for Google style.

If your project requires that you create a new XML document format, the XML Document Format Style Guide may be helpful. In addition to actual style rules, it also contains advice on designing your own vs. adapting an existing format, on XML instance document formatting, and on elements vs. attributes.

The style guides in this project are licensed under the CC-By 3.0 License, which encourages you to share these documents. See https://creativecommons.org/licenses/by/3.0/ for more details.

The following Google style guides live outside of this project: Go Code Review Comments and Effective Dart.

Creative Commons License