Instance Scan Linter Check Rhino Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm trying to create a linter check to scan for client scripts on a fresh Australia PDI but am always getting the following Failure.
Rhino error: missing ; before statement
I've stripped the linter check script to a barebones version to see if I still get the failure, and I do.
(function (engine) {
var TABLES_TO_CHECK = ["sys_script_client"];
if (TABLES_TO_CHECK.indexOf(String(engine.current.getTableName())) == -1) {
return;
}
gs.info(new GlideDateTime().getNumericValue() + " Current script being checked: " + engine.current.getValue("name") + " " + engine.current.sys_id);
})(engine);
Is there a way to print a stack trace to see what segment of code is causing this error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Just did a copy/past of your code, scan: no error.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @shalexander
Can you try this once :
(function (engine) {
var TABLES_TO_CHECK = "sys_script_client";
var currentTable = engine.current.getTableName().toString();
if (TABLES_TO_CHECK.indexOf(currentTable) == -1)
{
return;
}
gs.info(new GlideDateTime().getNumericValue() + " Current script being checked: " + engine.current.getValue('name') + " " + engine.current.sys_id);
})(engine);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Tanushree,
I tried your code but no luck. Still receiving a rhino error.
From my understanding, the AST generated in the lint checker comes directly from rhino, so my assumption is that the lint checker is running into trouble parsing one of the scripts? I just am not able to pinpoint which script that might be because the error message is very vague.
Trying to see if I can print a stack trace of some sorts. Had no luck with wrapping my entire lint checker script in a try catch block either.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @shalexander
Can you try
1. Clear instance cache using cache.do
2. Test it again in InCognito/InPrivate browser .
Check what result you are getting
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
I've exhausted all of my ideas... Not sure if we are able to check which script is causing the rhino error with the tools on-hand because the instantiation of the abstract syntax trees seem very black box-ish.
Shamelessly going to tag @Daniel Draes as I have watched one of your instance scan demos on youtube