Skip to content

Add and use python for formatting.#6298

Merged
larshg merged 3 commits into
PointCloudLibrary:masterfrom
larshg:UsePythonToCallClangFormat
Jul 10, 2025
Merged

Add and use python for formatting.#6298
larshg merged 3 commits into
PointCloudLibrary:masterfrom
larshg:UsePythonToCallClangFormat

Conversation

@larshg

@larshg larshg commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

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

larshg commented Jun 26, 2025

Copy link
Copy Markdown
Contributor Author

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
Comment thread .dev/format.py Outdated
Comment thread .dev/format.py Outdated
import subprocess
import argparse

WHITELIST = [

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@larshg larshg merged commit b246e16 into PointCloudLibrary:master Jul 10, 2025
13 checks passed
@larshg larshg deleted the UsePythonToCallClangFormat branch July 10, 2025 19:39
@mvieth mvieth added the changelog: enhancement Meta-information for changelog generation label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: enhancement Meta-information for changelog generation module: ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants