Style guides for Google-originated open-source projects
Go to file
2018-06-06 11:20:52 +02:00
cpplint Fix a typo in cpplint 2018-04-15 22:02:40 +09:00
docguide Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
include Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
c-style.el Drop "google" from file names, to make them more palatable. :) 2018-06-05 11:39:36 +02:00
cppguide.html Minor updates to C++ style guide. 2018-02-21 05:44:55 -08:00
cppguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
eclipse-cpp-style.xml Drop "google" from file names, to make them more palatable. :) 2018-06-05 11:39:36 +02:00
eclipse-java-style.xml Adjust java style (and Eclipse and IntelliJ configs) to 4 spaces indent and 120 columns. 2018-06-05 12:12:00 +02:00
intellij-java-style.xml Adjust java style (and Eclipse and IntelliJ configs) to 4 spaces indent and 120 columns. 2018-06-05 12:12:00 +02:00
javaguide.css Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
javaguide.html Create separate section for legacy code, fix formatting 2018-06-06 10:40:07 +02:00
javaguidelink.png Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
jsoncstyleguide_example_01.png Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
jsoncstyleguide_example_02.png Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
jsoncstyleguide.html Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
jsoncstyleguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
lispguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
objcguide.md Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
objcguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
pyguide.html Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
pyguide.md Fix markdown headings not rendering 2018-03-22 15:52:20 +11:00
python_style.vim Drop "google" from file names, to make them more palatable. :) 2018-06-05 11:39:36 +02:00
README.md Add Eclipse import howto 2018-06-06 11:20:52 +02:00
Rguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
shell.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
styleguide.css Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
styleguide.xsl Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
vimscriptfull.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
vimscriptguide.xml Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00
xmlstyle.html Revert "Project import generated by Copybara." 2018-01-30 12:36:50 -05:00

Move Digital Style Guides

Every organization must have its own style guide: a set of conventions (sometimes arbitrary) about how to write code for that organization. It is much easier to understand a large codebase when all the code in it is in a consistent style. There is also benefit to be had from that style guide matching (or closely following) a more widely used style guide.

“Style” covers a lot of ground, from “use camelCase for variable names” to “never use global variables” to “never use exceptions.” This project (AmanaAdvisors/styleguide) links to the style guidelines we use for Move Digital code. Much of it is borrowed wholesale from the Google style guide (see the "arbitrary" and "matching"/"following" above), with tiny, specific changes to better match the prevailing status quo at the time of adoption.

The core and main focus of this project is the Java Style Guide, as we are primarily a Java shop. For that end it provides Eclipse and IntelliJ code style profiles, which imported into your IDE of choice, allow you to quickly format code (and more easily write properly formatted code to begin with).

This project also holds style guides for the C++, Objective-C, Python, R, Shell Script, Common Lisp, and Vimscript; as well as cpplint, a tool to assist with style guide compliance, and c-style.el, an Emacs settings file for C/C++. If you find yourself writing code in one of these languages, it is arguably better to begin with some rules in place.

The notable absentees from this list are JavaScript/HTML/CSS. The style guides for these are covered in the UX team's Coding Conventions and Team Best Practices document.

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 following style guides live outside of this project: Go Code Review Comments and Effective Dart.

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.

Importing the Java code style profile into Intellij IDEA

  1. Download intellij-java-style.xml to your local disk.
  2. In IDEA menu, follow Intellij IDEA -> Preferences -> (In opened window expand) Editor -> Code Style -> Java -> Find "Scheme" label and next to the value of it find the gear icon.
  3. Click on the icon -> Import Scheme -> Intellij Idea Code Style XML -> Find and select intellij-java-style.xml on the local disk.

Importing the Java code style profile into Eclipse

  1. Download eclipse-java-style.xml to your local disk.
  2. In the Eclipse menu, click on Window -> Preferences, then navigate to Java -> Code Style -> Formatter.
  3. In the right panel click on Import..., select intellij-java-style.xml from the local disk and click "OK".
  4. Back in the Preferences dialog, click Apply and Close.

Creative Commons License