Linter / Syntax Checker for template files for Engine 2.3?

Philip Schlesinger <[email protected]> Thu, 15 Aug 2024 00:30:57 +0000
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <LV8PR17MB7135CD32D9E16ED85F7C460CAE802@LV8PR17MB7135.namprd17.prod.outlook.com>
--_007_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_
Content-Type: multipart/alternative;
	boundary="_000_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_"

--_000_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi all,

Where can I find a linter / syntax checker for template files written for E=
ngine 2.3?

Jama Software=92s implementation of Velocity Engine 2.3 starts with an expo=
rt of a Word .mht file.  Jama then adds in data sources and macros.

The _boilerplate_ Velocity template file for a Word document is =96 I kid y=
ou not =96 4,408 lines of code.

The amount of code that needs to be touched to customize the template file =
for one=92s own usage: less than 200 lines of code =96 about 4.5%.

At this time, they do not permit the usage of parent-template.vm and child-=
template.vm =96 then using the #parse directive.

So to reduce the chance of a fat-finger, I=92ve split the 4,408 lines of co=
de boilerplate file into multiple files =96 separating out sections where o=
ne would customize (title page, header, main body, etc.) from the sections =
which one should normally not touch (for instance: the CSS that came from t=
he Word .mht file).

With a `cat *.vm` command, voila! We have a unified file again.

Just to be safe, I=92d like to run a linter / syntax checker on it.  So far=
 the only checker I=92ve found that is built to support Engine 2.3 is `pmd`=
: https://docs.pmd-code.org/latest/pmd_rules_velocity.html

Even then, I=92m not sure if it=92s truly doing a thorough lint / syntax ch=
eck.

The npm velocity-lint hasn=92t been updated in 8 years: https://github.com/=
leemotive/velocity-lint

Velocity-validator last got an update 6 years ago: https://github.com/todvo=
ra/velocity-validator

This whole StackOverflow is from 14 years ago: https://stackoverflow.com/qu=
estions/1910857/apache-velocity-is-there-a-standard-way-of-verifying-the-co=
rrectness-of-a-templ

I=92ve seen posts about a =93Template Tool=94 =96 but I can=92t find it =96=
 and I=92m guessing it hasn=92t been supported in years.

Hence my email to the community.

Is there a velocity linter / syntax checker out there that evaluates Engine=
 2.3 =96 or is there example code that I can copy/paste to build my own?

Thank you for your assistance!

--

Philip Schlesinger
Solution Architect =96 Core Systems

[Blue text on a black background  Description automatically generated]<http=
://www.cryoport.com/>
=AD=AD
Office:  +1 (949) 681-2794
24/7/365 Support:  +1 (949) 470-2305

Americas =95 EMEA =95 APAC
cryoport.com<http://cryoport.com/>

[A blue circle with white and black logo  Description automatically generat=
ed]<https://www.linkedin.com/company/856887>[A blue circle with white x in =
it  Description automatically generated]<https://twitter.com/cryoport> [A b=
lue circle with a white play button  Description automatically generated] <=
https://www.youtube.com/user/CryoportVideo>
=AD=AD
The information contained in this e-mail message is privileged and confiden=
tial information and is intended only for the use of the individual and/or =
entity identified in the address of this message. If the reader of this mes=
sage is not the intended recipient, or an employee or agent responsible to =
deliver it to the intended recipient, you are hereby notified that any disc=
losure, copying, distribution, or reliance upon the contents of this email =
is strictly prohibited. If you have received this communication in error, p=
lease notify us by return e-mail. In this circumstance, we request that you=
 delete the original message from your system.


--_000_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Aptos;
	panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:11.0pt;
	font-family:"Aptos",sans-serif;
	mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#467886;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Aptos",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:11.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:348262704;
	mso-list-template-ids:270064016;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level5
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level8
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7 ;
	mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--></style>
</head>
<body lang=3D"EN-US" link=3D"#467886" vlink=3D"#96607D" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi all,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Where can I find a linter / syntax checker for templ=
ate files written for Engine 2.3?<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Jama Software=92s implementation of Velocity Engine =
2.3 starts with an export of a Word .mht file.&nbsp; Jama then adds in data=
 sources and macros.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">The _<i>boilerplate</i>_ Velocity template file for =
a Word document is =96 I kid you not =96 4,408 lines of code.<o:p></o:p></p=
>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class=3D"MsoNormal">The amount of code that needs to be touched to custo=
mize the template file for one=92s own usage: less than 200 lines of code =
=96 about 4.5%.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">At this time, they do not permit the usage of parent=
-template.vm and child-template.vm =96 then using the #parse directive.<o:p=
></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">So to reduce the chance of a fat-finger, I=92ve spli=
t the 4,408 lines of code boilerplate file into multiple files =96 separati=
ng out sections where one would customize (title page, header, main body, e=
tc.) from the sections which one should
 normally not touch (for instance: the CSS that came from the Word .mht fil=
e).<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">With a `cat *.vm` command, voila! We have a unified =
file again.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Just to be safe, I=92d like to run a linter / syntax=
 checker on it.&nbsp; So far the only checker I=92ve found that is built to=
 support Engine 2.3 is `pmd`:
<a href=3D"https://docs.pmd-code.org/latest/pmd_rules_velocity.html">https:=
//docs.pmd-code.org/latest/pmd_rules_velocity.html</a><o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Even then, I=92m not sure if it=92s truly doing a th=
orough lint / syntax check.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">The npm velocity-lint hasn=92t been updated in 8 yea=
rs: <a href=3D"https://github.com/leemotive/velocity-lint">
https://github.com/leemotive/velocity-lint</a><o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Velocity-validator last got an update 6 years ago: <=
a href=3D"https://github.com/todvora/velocity-validator">
https://github.com/todvora/velocity-validator</a><o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">This whole StackOverflow is from 14 years ago: <a hr=
ef=3D"https://stackoverflow.com/questions/1910857/apache-velocity-is-there-=
a-standard-way-of-verifying-the-correctness-of-a-templ">
https://stackoverflow.com/questions/1910857/apache-velocity-is-there-a-stan=
dard-way-of-verifying-the-correctness-of-a-templ</a><o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I=92ve seen posts about a =93Template Tool=94 =96 bu=
t I can=92t find it =96 and I=92m guessing it hasn=92t been supported in ye=
ars.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Hence my email to the community.&nbsp; <o:p></o:p></=
p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Is there a velocity linter / syntax checker out ther=
e that evaluates Engine 2.3 =96 or is there example code that I can copy/pa=
ste to build my own?<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Thank you for your assistance!<span style=3D"font-fa=
mily:&quot;Calibri&quot;,sans-serif;mso-ligatures:none"><o:p></o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-family:&quot;Calibri&quot;,sans-=
serif;mso-ligatures:none"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-family:&quot;Calibri&quot;,sans-=
serif;mso-ligatures:none">--&nbsp;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-family:&quot;Calibri&quot;,sans-=
serif;mso-ligatures:none"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"line-height:105%"><b><span style=3D"font-si=
ze:15.0pt;line-height:105%;font-family:&quot;Arial&quot;,sans-serif;color:#=
1B1CDD;mso-ligatures:none">Philip Schlesinger</span></b><span style=3D"font=
-family:&quot;Calibri&quot;,sans-serif;mso-ligatures:none"><br>
</span><b><span style=3D"font-size:10.0pt;line-height:105%;font-family:&quo=
t;Arial&quot;,sans-serif;color:#373A36;mso-ligatures:none">Solution Archite=
ct =96 Core Systems<o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:9.0pt;font-family:&quot;=
Arial&quot;,sans-serif;color:#373A36;mso-ligatures:none"><o:p>&nbsp;</o:p><=
/span></b></p>
<p class=3D"MsoNormal"><a href=3D"http://www.cryoport.com/"><span style=3D"=
font-family:&quot;Arial&quot;,sans-serif;color:#00B3E3;text-decoration:none=
"><img border=3D"0" width=3D"229" height=3D"73" style=3D"width:2.3854in;hei=
ght:.7604in" id=3D"Picture_x0020_4" src=3D"cid:[email protected]=
30" alt=3D"Blue text on a black background=0A=
=0A=
Description automatically generated"></span></a><b><span style=3D"font-size=
:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#373A36;mso-ligatures=
:none"><o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:#1B1CDD;mso-ligatures:none">=AD=AD<o:p></o:p>=
</span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:#1B1CDD;mso-ligatures:none">Office:&nbsp;
</span></b><span style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,sa=
ns-serif;color:#373A36;mso-ligatures:none">+1 (949) 681-2794<o:p></o:p></sp=
an></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:#1B1CDD;mso-ligatures:none">24/7/365 Support:=
&nbsp;
</span></b><span style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,sa=
ns-serif;color:#373A36;mso-ligatures:none">+1 (949) 470-2305<o:p></o:p></sp=
an></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:#373A36;mso-ligatures:none"><o:p>&nbsp;</o:p></s=
pan></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:#373A36;mso-ligatures:none">Americas
</span></b><b><span style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;=
,sans-serif;color:#1B1CDD;mso-ligatures:none">=95</span></b><b><span style=
=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#373A36=
;mso-ligatures:none"> EMEA
</span></b><b><span style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;=
,sans-serif;color:#1B1CDD;mso-ligatures:none">=95</span></b><b><span style=
=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#00CBE0=
;mso-ligatures:none">
</span></b><b><span style=3D"font-size:10.0pt;font-family:&quot;Arial&quot;=
,sans-serif;color:#373A36;mso-ligatures:none">APAC<o:p></o:p></span></b></p=
>
<p class=3D"MsoNormal"><span style=3D"font-family:&quot;Calibri&quot;,sans-=
serif;mso-ligatures:none"><a href=3D"http://cryoport.com/"><b><span style=
=3D"font-size:10.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#0563C1=
">cryoport.com</span></b></a></span><b><span style=3D"font-size:10.0pt;font=
-family:&quot;Arial&quot;,sans-serif;color:#373A36;mso-ligatures:none"><o:p=
></o:p></span></b></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:#777877;mso-ligatures:none"><o:p>&nbsp;</o:p></s=
pan></p>
<p class=3D"MsoNormal"><a href=3D"https://www.linkedin.com/company/856887">=
<span style=3D"font-family:&quot;Arial&quot;,sans-serif;color:#99999A;text-=
decoration:none"><img border=3D"0" width=3D"33" height=3D"33" style=3D"widt=
h:.3437in;height:.3437in" id=3D"Picture_x0020_3" src=3D"cid:image002.png@01=
DAEE6D.206F6C30" alt=3D"A blue circle with white and black logo=0A=
=0A=
Description automatically generated"></span></a><a href=3D"https://twitter.=
com/cryoport"><span style=3D"font-family:&quot;Arial&quot;,sans-serif;color=
:#00B3E3;text-decoration:none"><img border=3D"0" width=3D"33" height=3D"33"=
 style=3D"width:.3437in;height:.3437in" id=3D"Picture_x0020_2" src=3D"cid:i=
[email protected]" alt=3D"A blue circle with white x in it=0A=
=0A=
Description automatically generated"></span></a><span style=3D"font-family:=
&quot;Arial&quot;,sans-serif;color:#00B3E3;mso-ligatures:none">&nbsp;</span=
><a href=3D"https://www.youtube.com/user/CryoportVideo"><span style=3D"font=
-family:&quot;Arial&quot;,sans-serif;color:#00B3E3;text-decoration:none"><i=
mg border=3D"0" width=3D"32" height=3D"32" style=3D"width:.3333in;height:.3=
333in" id=3D"Picture_x0020_1" src=3D"cid:[email protected]" al=
t=3D"A blue circle with a white play button=0A=
=0A=
Description automatically generated"></span></a><span style=3D"font-size:12=
.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#00B3E3;mso-ligatures:n=
one"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:#777877;mso-ligatures:none">=AD=AD<o:p></o:p></s=
pan></p>
<p class=3D"MsoNormal"><span style=3D"font-size:9.0pt;font-family:&quot;Ari=
al&quot;,sans-serif;color:black;mso-ligatures:none">The information contain=
ed in this e-mail message is privileged and confidential information and is=
 intended only for the use of the individual and/or
 entity identified in the address of this message. If the reader of this me=
ssage is not the intended recipient, or an employee or agent responsible to=
 deliver it to the intended recipient, you are hereby notified that any dis=
closure, copying, distribution,
 or reliance upon the contents of this email is strictly prohibited. If you=
 have received this communication in error, please notify us by return e-ma=
il. In this circumstance, we request that you delete the original message f=
rom your system.<o:p></o:p></span></p>
</div>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_--

--_007_LV8PR17MB7135CD32D9E16ED85F7C460CAE802LV8PR17MB7135namp_--