Skip to content

Add clang-format configuration #265

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 2 commits into
base: master
Choose a base branch
from

Conversation

MinyazevR
Copy link
Contributor

This PR aims to add ClangFormat to PythonQt. During the discussion, it was decided that clang-format is a valid solution.
A version of clang-format-20 or higher is required, and a testing script (run-clang-format.sh) has been written for testing and/or running in CI.

It is worth noting that the PythonQt Generator has a style that differs from the main src directory. If this is a priority, you can put a separate .clang-format in the generator directory, which will override the parent one.

The following steps:

  1. Run run-clang-format.sh locally
  2. If you are satisfied with the formatting result, merge this PR (possibly changing some .clang-format parameters)
  3. Merge formatted code
  4. Add CI

@mrbean-bremen
Copy link
Contributor

It is worth noting that the PythonQt Generator has a style that differs from the main src directory

This has been discussed before, @usiems wrote:

The generator is composed of sources from different sources, with vastly different styles,

As far as I understand, there is a consensus that a common style would be ok.

@usiems
Copy link
Contributor

usiems commented Jun 27, 2025

The code in generator/simplecpp should be excluded from the reformatting, as this is code from an external source which might be updated again in the future.

@mrbean-bremen
Copy link
Contributor

I had a look at the formatted code, and it mostly looks good to me (with a couple of things that I probably would like to change in the config).
Before continuing with this PR, I would like to wait for the other large PR from the Slicer folks (which may take a while) to avoid a lot of conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants