· Feb 1, 2018

Beautifying for Object Script ?

This a spin of from For and If with one line: to brace or not to brace
Has anyone seen or heard of a Beautifier for Object Script?

There is a bunch of them out for XML, HTML, JavaScript, CSS, PHP,  ....

What I think of is a utility / package that is able to

  • #1 format your source code by appropriate Tabs/Spaces
  • #2 (more important) - to replace legacy notation with bracket notation - to wrap all kind of (post-)conditions in JavaScript style

I'ts definitely a tricky thing.
And I never head of any attempt to do it. 

A simple example:

IF a=2 set b=2
ELSE  set b=0

might  become 

set $TEST= (a=2)
IF ($TEST) { set b=2 }
ELSE {set b=0 }

to move to brackets and maintain $TEST correctly

Also covering all the other strange things you know all

Discussion (8)0
Log in or sign up to continue

Unfortunately, it is not so easy to implement it without a good parser. InterSystems still don't want to publish any sort of parsers. And not sure they have plans to implement it in Atelier, yet. While we still have so many troubles in Atelier, it would be better if they will fix it first. And then it would be possible to ask, hope it will not take so long.

In your case, it is not only beautifier it is also static syntax check. Which can recommend changing some bad practices/old school/possible error code. And it is done by project CacheQuality