Liking the formatting tool. We are looking to incorporate code reformatting as part of our code review process. There is nothing worse than - or more time consuming than untidy code.

So our company, as part of the coding process, will insist that code if formatted to the same set of SA rules across all devs.

You can obviously change the rule templates for code formatting and formatted code has a header comment '* Code formatted by SoftTree...' at the top. This includes useful information such as Date and Time. OK - nothing new to you from my post so far.

My question: Is there any way that I can use (I believe they are called) macro variables to trap who formatted the code - kind of like $LOGIN$ or $USER$ - within the header comment? The gain here is that the header shows that a specific developer formatted the code at a specific time and date.

It might seem overkill - but I'm being asked for it.. :/

thanks in advance. :)

Fri Sep 14, 2012 8:53 am

SysOpSite Admin

Joined: 26 Nov 2006Posts: 6509

I'm not sure the code formatting can use dynamic macro variables like the code generator, code refactoring functions, and code snipepts. I've played with it for a little while and it seems to understand only 3 simple macros $DATE$, $TIME$ and $SA_VERSION$, it didn't recognize anything else. I tried the built in $OSUSER$ and $USER$ and they didn't work for me.

So I would think the only solution for now is having each developer to customize the "(header)" rule in the settings and replace the preconfigured text with something like

Though $USER$ and $LOGIN$ would be useless when formatting code offline, if that matters, I support the idea of having all the three available in header.

Fri Sep 14, 2012 2:33 pm

SysOpSite Admin

Joined: 26 Nov 2006Posts: 6509

There are existing $OS_USER$ and $USER$ which might be helpful in the code formatting when used within comments.

Fri Sep 14, 2012 2:43 pm

gemisigo

Joined: 11 Mar 2010Posts: 1401

Yes, those are put to heavy use when creating objects like tables, stored procedures, functions, etc. but most of the ad-hoc codes never get commented even if they're re-used frequently. On the other hand, they're reformatted after each and every change made to them so these could help make this process become semi-automatic. I don't think this to be essential. After all, I'm the only one using SA here (I'm still trying to convince the management to buy more licences) so it's quite obvious if I've touched the code :) But it's a good candidate for a feature request.

Fri Sep 14, 2012 2:59 pm

SysOpSite Admin

Joined: 26 Nov 2006Posts: 6509

This feature has been implemented in the latest version 6.3. Please consider upgrading to that version.