0

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

Amelia
  • 1
  • 1
  • Are you using an IDE, if so which one? Do you have a linter set up for the project you're working on? Is this the configuration file for Uncrustify or something else that you're running Uncrustify on? – Ruby A. Rose Apr 18 '20 at 04:50
  • @RubyA.Rose I'm using VS Code with no linter. This is a test class that I'm running uncrustify on. – Amelia Apr 19 '20 at 07:42
  • would you mind posting your current configuration file here as well? – Ruby A. Rose Apr 19 '20 at 10:13
  • The particular language the example is in would be helpful as well considering that some parsing is unique per the language you're Linting. Also as a side note I'm an idiot; Uncrustify is a linter / beautifier. – Ruby A. Rose Apr 19 '20 at 10:21
  • The language is the Salesforce language Apex which is based on Java. – Amelia Apr 20 '20 at 20:13
  • Edited question to add uncrustify config https://pastebin.com/4bnNXzhC – Amelia Apr 20 '20 at 20:19

1 Answers1

0

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.

Ruby A. Rose
  • 173
  • 1
  • 5