This PR introduces a plugin, pre-commit, which can check coding styles and format the code automatically.
I have formatted aerial_robot_base folder as an example.
Details
To install, please read doc in ./docs folder. In general, there are only two commands needed to be executed.
pip install pre-commit
pre-commit install
Then this plugin will automatically triggered before each commit. I have included several check items inside the .pre-commit-config.yaml. Now I use black to format Python code and clang to format C++.
If the commit cannot pass the check, just run commit again. The plugin will format the code automatically and then the second commit will pass.
After discussion, change the code style back to Google style, except that line width = 120.
This PR involves so many changes in existing files. I am afraid that it will broke the backward compatiblity.
Maybe we can correct format for all files when we decide to shift to 2.0.0.
What is this
This PR introduces a plugin, pre-commit, which can check coding styles and format the code automatically.
I have formatted aerial_robot_base folder as an example.
Details
To install, please read doc in ./docs folder. In general, there are only two commands needed to be executed.
Then this plugin will automatically triggered before each commit. I have included several check items inside the .pre-commit-config.yaml. Now I use black to format Python code and clang to format C++.
If the commit cannot pass the check, just run commit again. The plugin will format the code automatically and then the second commit will pass.
After discussion, change the code style back to Google style, except that line width = 120.