Skip to content

Add and use python for formatting. #6298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

larshg
Copy link
Contributor

@larshg larshg commented Jun 25, 2025

More cross platform than shell script.

@larshg larshg force-pushed the UsePythonToCallClangFormat branch 2 times, most recently from 3ab309b to af06225 Compare June 25, 2025 19:24
@larshg larshg requested a review from mvieth June 26, 2025 17:02
@larshg
Copy link
Contributor Author

larshg commented Jun 26, 2025

This seems to work as far as I have tested with various changes in files, both with pre-commit and here in CI calling the same python script.
I'll cut out the "format" error, before merge.

@larshg larshg added this to the pcl-1.15.1 milestone Jun 26, 2025
.dev/format.py Outdated
import subprocess
import argparse

WHITELIST = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put these paths into a separate file (e.g. .dev/paths_to_format.txt) and then read that file both in format.py and format.sh? To avoid duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually thinking to remove the format.sh after a while, seeing that the python script performs as intended. So I could use the same list/file for both manual/ci formatting and for pre-commit.
We can do the split if you prefer to keep the format.sh and perhaps AI can help with the shell programming 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer to keep format.sh for now. The shell command cat is probably sufficient to print the content of the file, so maybe local whitelist="${cat ${PCL_DIR}/.dev/paths_to_format.txt}"?

@larshg larshg force-pushed the UsePythonToCallClangFormat branch from a18a512 to 329bb13 Compare June 28, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants