Closed Timple closed 2 years ago
@Timple the reason I never pursued this more is we transitioned to a different tool for formatters. Instead of one that works on the ROS package level we use one that works on the the whole repo to run formatters like black. The tool is called pre-commit and you can find how we configure it here: https://github.com/ros-planning/moveit2/blob/main/.pre-commit-config.yaml
It is a python3 tool and can be installed like this:
python3 -m pip install pre-commit
If you don't have pip installed you will need that:
sudo apt install python3-pip
Then to run the formatters on your repo (after you have a config file like the one above) you can run this command:
pre-commit run --all
If you want to then run it in CI you can copy our CI config that does just that here: https://github.com/ros-planning/moveit2/blob/main/.github/workflows/format.yaml
If instead, you'd like to have this project I'm happy to transfer this repo to you and you can release it into the buildfarm. Let me know. Because we have a different approach for this that we think works better for us we are not using this tool.
Yes, pre-commit hooks would be nice method as well.
But we have a lot of repositories. So keeping al these pre-commit hooks in sync might be a hassle. And as far as I can tell from the documentation, you cannot really run these 'globally'. For packages we kind of have a method already in place...
Anyhow, I took the first step anyway: https://github.com/ros/rosdistro/pull/33362 🙂
Would you consider releasing these packages to the buildfarm?
It would probably ease adoption of the project. As compiling two packages from source on every CI run seems a bit much for a formatter.