简体   繁体   中英

Uncrustify - whats adding space between 'assert' and '('

No matter how I update the config file I seem to always end up with a space

System.assert(true); becomes System.assert (true);

This is only when the function is called assert

The following both format without a space before the '('

System.asser(true);

System.assertt(true);

Uncrustify config https://pastebin.com/4bnNXzhC

I believe your problem is that Java has an assert statement which Uncrustify's confusing your function call as. Although that wouldn't make much sense considering I tried to test if adding/removing spaces before control statements would change this behavior and it didn't.

I did find a workaround for you through the following configuration options parsing as Java. Since Java supports the assert statement it is a bit odd that they don't have a specific configuration option for it. It may be in your best interest to file a bug report / GH issue with the Uncrustify devs to help better resolve this problem.

# Add or remove space between the user function name and '(' on function
# calls. You need to set a keyword to be a user function in the config file,
# like:
#   set func_call_user tr _ i18n
sp_func_call_user_paren         = remove   # ignore/add/remove/force

set func_call_user assert

Keep in mind that Apex is not an officialy supported language of Uncrustify. So if things don't work specifically for Apex then there's really not much else that can be done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM