In this document are enumerated the different guidelines related to the contribution to Coconut 🥥.
The file describes how the docker image for coconut should be built. It should rarely change.
This is the file that invokes the coconut binary on each file to check.
It also generates the necessary compilation database using Bear.
It should be run inside of the docker, but supports running outside of it. If it detects it is being run inside docker, it will copy the delivery directory to another directory, to avoid polluting the delivery directory with compilation artifacts.
We use CMake to build this project. If you don't know how it works, don't worry, you will probably just need to add entries to the SOURCES list.
Directory containing the C++ source files for Coconut.
Directory containing the rules. Each one represent a rule in the coding style, and is written in C++.
Each rule check if any violations exist, and reports them if necessary.
This script builds the docker image, and runs all the functional tests.
Directory containing all the test files related to the functional tests for Coconut. Checkout the test document to know how to write tests.
When adding a rule to Coconut, the following steps should be followed:
- Create a new branch named
feature/rule-XXfrom themainbranch, withXXbeing the rule's name (without the "C-" part). - Create a source file named
sources/rules/RuleXX.cpp. - Add the source file to the
CMakeLists.txtso it compiles. - Add the rule to the
sources/rules/Rules.incso the required class is declared and enabled. - Add comprehensive functional tests for the rule.
- Write the rule (please comment it while doing so, and respect the internal coding style).
- Update the entry for the rule in the README
- When all the tests pass (with
./ftests.sh), open a pull request namedRule XX: XXXX(with withXXbeing the rule's identifier, andXXXXthe comment) aimed at being merged intomain, and request a review. - Iterate on the reviews and requests made.
- When everything is OK and approved, your PR will be merged into
main. - Congratulations, you have now added a rule to Coconut!
Introduction to the clang AST (video)