jcberquist / commandbox-cfformat

A CommandBox module for formatting CFML component files.
MIT License
22 stars 10 forks source link

support explicit function case entries #71

Closed chapmandu closed 4 years ago

chapmandu commented 4 years ago

It would be great to specify certain edge case functions which fall outside of the configured case rules. In particular, functions that begin with an acronym. Eg:

Actual result:

Val(1); // builtin
uRLFor(href = "/foo"); // userdefined
xMLIsOkay(xml); // userdefined

Desired result:

Val(1); // builtin is pascal
URLFor(href = "/foo"); // userdefined is camel
XMLIsOkay(xml);

.cfformat.json

"function_call.casing.builtin": "pascal",
"function_call.casing.userdefined": "camel",
 // proposed (name TBA)
"function_call.casing.custom": [ "URLFor", "XMLIsOkay"]
jcberquist commented 4 years ago

I wonder if it would be better just to not lowercase the first letter if the function name starts with running capitals? So that DoSomething() would become doSomething() (as it does now), but if you did DOSomething() (or XMLIsOkay) it just left it as is?

chapmandu commented 4 years ago

Even better.. one less thing to configure. 👍

jcberquist commented 4 years ago

I have implemented this as per my comment above in v0.14.3.