Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 2.04 KB

code_style_tools.rst

File metadata and controls

65 lines (44 loc) · 2.04 KB

Tools for Code Style Compliance

This section provides a list of tools that some have found useful for ensuring their code abides by :ref:`Drake's coding style <code-style-guide>`. The list is by no means comprehensive. If your favorite tools or methodologies are not listed, we would be delighted to learn about them. Please document your trick and submit a pull request!

Code style tests are run by default during bazel test and the results are cached so that only edited files are re-checked. In other words, no special action is required by a developer.

However, you may still invoke code style checks directly if desired, as follows:

cd /path/to/drake
bazel test --config lint //...         # Only run style checks; don't build or test anything else.
bazel test --config lint //common/...  # Check common/ and its child subdirectories.

User manuals for the style-checking tools are as follows:

The :ref:`Mandatory platform specific instructions <platform_specific_setup>` install Drake's required version of clang-format, depending on the platform (macOS or Ubuntu).

To run clang-format:

# For development on macOS:
/usr/local/opt/llvm@6/bin/clang-format -i -style=file [file name]

# For development on Ubuntu:
clang-format-6.0 -i -style=file [file name]