[ColdBox 4.3.0] Symmetrical braces in generated code

In my personal projects, I’ve used symmetrical braces forever. Work does too, and I didn’t start that. It just seems much more logical and readable to me than K & R-style, makes code structure much clearer.

For example:

Symmetrical:

function foo()
{
doStuff();
if (something()
{
for (bar in splat)
{
doMoreStuff(bar);
andYetMore(bar.splat);
}
}
}

K & R:

function foo() {
doStuff();
if (something() {
for (bar in splat) {
doMoreStuff(bar);
andYetMore(bar.splat);
}
}

I’m not asking anyone to agree, just wondering if there’s a way to tell the CommandBox generators for ColdBox to use symmetrical style braces? Probably not, but thought I’d ask.

The coldbox create app command can be pointed at any endpoint so you can have a custom app skeleton if you want. However the commands like coldbox create handler aren’t customizable. This has been suggested before
https://ortussolutions.atlassian.net/browse/COMMANDBOX-490

Please add any thoughts or suggestions to that ticket, or feel free to take a stab at it and offer a pull request. Minimally, a user could specify an external directory of templates for the scaffolding commands to look at. It would be sort of messy, but it would work. There’s quite a few individual template files especially with the tag and script version of everything.

https://github.com/Ortus-Solutions/commandbox/tree/development/src/cfml/system/modules_app/coldbox-commands/templates

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hmmm, alternate templates just to change brace indenting isn’t really what I was imagining.

I use IntelliJ IDEA as my editor, and like many editors, it has Code Style settings, customizable by language, which can be applied to code that’s already written. I wonder if there are “pluggable” versions of that sort of functionality. If so, the ability to process the existing templates through something like that would be pretty nice.

OTOH, it’s not that important, since IDEA can do it after the fact. Would be cool though :slight_smile:

Dave