Google provides a python script to check for a variety of google guideline rules. The script and license has been copied to the Rialto directory.
To see how to run the script from the root of the rialto directory run: ./scripts/cpplint/cpplint.py --help
https://github.com/cpplint/cpplint
The python script can be modified under the license, any modifications are described here:
| Category | Modification |
|---|---|
| Header Guard | Changed the format the script checks for to NAMESPACE_FILENAME_H_. GetHeaderGuardCPPVariable will also return a list of possible header guards names based on the namespaces defined in the file. |
| Filename Format | New function which is run on every file to check that the directories and file is named correctly. |
| Pragma Once | Do not allow pragma once instead of header guard. |
| Function Name Format | New function which runs on ever line to detect a function implementation and check the function name format. |
| Class Name Format | New function which runs on ever line to detect a class declaration and check the class name format. |
| Unnamed Namespace | Checks for namespace key work with no preceding characters. Google checked for '{' which is not possible in Rialto. |
| Namespace Name Format | Check the namespace name format. |
Clang format, formats the code in the rialto directory using a set of rules defined in ./clang-format.
https://clang.llvm.org/docs/ClangFormat.html
Clang-format v10 is the one we use in our repository. Some Ubuntu machines will automatically install v6.
To install:
If version is not v10: