Clang-Format - AlwaysBreakBeforeElse

Apologies for the “newbie question”, I would like to know if I were to proceed with looking at implementing a “AlwaysBreakBeforeElse” configuration option to Clang-Format would I be working against the general direction of Clang Format?

I would like to format

if (x){
}
else {
}

in combination with BreakBeforeBraces “Linux” style (for classes, namespaces and functions)

I found a previous submission that performed something l like what I needed but I couldn’t see this submission in the “trunk”

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140505/105216.html

I wondered if this had not been submitted, rejected and/or if there was a reason why?

Many thanks in advance

MyDeveloperDay
https://mydeveloperday.wordpress.com/

@mydeveloperday

Apologies for the "newbie question", I would like to know if I were to
proceed with looking at implementing a "AlwaysBreakBeforeElse"
configuration option to Clang-Format would I be working against the general
direction of Clang Format?

Not against the direction of clang-format, but against the direction of
Linux/Kernel style:
https://www.kernel.org/doc/Documentation/CodingStyle

I would like to format

if (x){
}
else {
}

in combination with BreakBeforeBraces "Linux" style (for classes,
namespaces and functions)

I found a previous submission that performed something l like what I
needed but I couldn't see this submission in the "trunk"

r214857

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140505/105216.html

I wondered if this had not been submitted, rejected and/or if there was a
reason why?

Many thanks in advance

Do this help?
Cheers,
Daniel

I agree not a standard style, but a requested style. (I see a number of requests on stackoverflow, plus I believe I need this to complete my teams preferred style)

I guess my question is, is the ethos of “Clang-Format” to only support standard styles or to be flexible enough to deliver required style built via customization of existing styles

I am happy to do the work to submit the patch, just would like to know if such a thing would get rejected on principle, i.e. would my patch be welcome?

MyDeveloperDay
https://mydeveloperday.wordpress.com/

@mydeveloperday

Daniel answers this question each time someone asks for setting or submits a patch. It really feels like you should add this info to clang-format page Daniel and just point to it :slight_smile:

Yeah, probably a good idea… Will put that on my pile of things I need to do ;-).