Request for CLang-Format Customizing

Hello, I am not sure that this is the right place, but I don’t know a better one.

We try to define a format file that fits our requirements for automatic code formatting.

For most of the format rules we found a setting what fits our requirements, or we can agree with one of the possible selections. But in some cases, the rules give us only the choice of Pest or Cholera.

We know about the option to exclude code areas from formatting by clang, but this is stupid way because we lost the other 99% of rules for this section, too

So, the question is, is there a way to disable a code style rule completely in clang. This gives the advantage that can use all accepted rules and put the other back under control of the programmer.

Many thanks for any response in advantage

Hi,

Not sure if it answers your question, but since recently, you can use BasedOnStyle: InheritParentConfig (cf. Clang-Format Style Options — Clang 13 documentation (llvm.org)).
What you can do is to inherit your default config, but disable the offending options for a particular directory (subtree).
But well, that’s obviously applicable if the code for which you want to exclude some options (or rather, change them) is grouped in a directory, but it won’t work nicely if you have both files that should be formatted with default rules and files with some rules disabled.

If you give more details about your code structure and requirements, it will be easier to help.