groovy/rtp-declared
Severity warning by default. It runs on Groovy bodies (.groovy) in a Pod
Folder.
What it checks
Section titled “What it checks”Every Run-Time Prompt your Groovy code reads through the rtps binding must be
declared by the Rule. A read is rtps.NAME, for example
rtps.RTP_ENTITY.toString(). The Rule declares its prompts in the RTPS header
comment at the top of the Body, and, for a Rule you have Pulled, in the prompt
definitions that came down with it. If neither one names the prompt you read,
the Validation Rule flags the read.
Details worth knowing:
- Prompt names are matched without regard to capitalization, the way Oracle
binds them.
{RTP_Fund}in the header coversrtps.rtp_fund. - A read inside a line or block comment does not count.
- A read inside a string interpolation does count, so
"Version: ${rtps.RTP_VERSION}"is a real read. rtps.get("NAME")andrtps.each { ... }are ignored, because the name is not visible in the code.- Each read is flagged separately, so two reads of the same missing prompt give you two squiggles and one quick fix.
Why it matters
Section titled “Why it matters”Oracle builds the prompt dialog from what the Rule declares. A prompt that is
not declared is never presented to the user, so at run time rtps.NAME has
nothing behind it. The Rule still runs, with a null value spliced into your FIX
or your assignment, which usually means the calculation silently targets the
wrong slice, or the Run fails with a syntax error deep inside a generated
script. Nothing about the Rule’s source looks wrong, which is what makes this one
expensive to find after the fact.
Example
Section titled “Example”An allocation Rule in acmeplan declares two prompts and reads three:
/* RTPS: {RTP_ENTITY}, {RTP_YEAR} */String entity = rtps.RTP_ENTITY.toString()String year = rtps.RTP_YEAR.toString()String version = rtps.RTP_VERSION.toString()RTP_VERSION is underlined, with this message:
Run-Time Prompt "RTP_VERSION" is read via rtps.RTP_VERSION but not declared in the RTPS header.The quick fix on that squiggle is Declare {RTP_VERSION} in the RTPS header, which adds the name to the header for you and matches the separator style already there:
/* RTPS: {RTP_ENTITY}, {RTP_YEAR}, {RTP_VERSION} */String entity = rtps.RTP_ENTITY.toString()String year = rtps.RTP_YEAR.toString()String version = rtps.RTP_VERSION.toString()If the read was the mistake (a typo, or a leftover from an older version of the Rule), delete the read instead. The Validation Rule cannot tell those two cases apart, which is why it is a warning and not an error.
Adjusting it
Section titled “Adjusting it”Change its severity or turn it off in the Validation Rules panel, or exempt one artifact with an Exception.