SCR205: wrong-scope-system-function
system.* function not available where the script runs
| Code | SCR205 |
| Name | wrong-scope-system-function |
| Category | Scripts (SCR) |
| Default severity | error |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports system.* members that do not exist in the scope the script runs
in, and Perspective functions called without a session where there is
none.
- Perspective scripts (component and view events, transforms, change
scripts, message handlers, custom methods, session and page events) run
on the gateway inside a session:
system.perspective.*is available,system.gui.*,system.nav.*and other Vision Client functions are not. - Gateway events, WebDev handlers and tag event scripts run on the gateway
without a Perspective session.
system.perspectiveexists there, but its functions that act on "the current session or page" (those with asessionIdparameter, such asnavigate,openPopup,sendMessageorprint) fail unlesssessionIdis given, positionally or by keyword. Calls that unpack arguments (*args,**kwargs) are not reported. - Vision Client scripts run in the Vision Client scope: gateway-only
functions such as
system.perspective.*are not available.
Only the first member that is missing is reported (system.gui in
system.gui.messageBox). Library modules are not reported: they run in
the scope of whatever imports them, and their hintScope only controls
the Designer's code hints.
Why is this bad?
Section titled “Why is this bad?”The script raises AttributeError (the member does not exist in that
scope) or fails because there is no session to act on.
Example
Section titled “Example”def runAction(self, event): system.gui.messageBox("Saved")Use instead:
def runAction(self, event): system.perspective.openPopup("saved", "Popups/Saved")Generated from the rule metadata by iglint generate-docs; iglint rule SCR205 prints the same page in the terminal. Source: docs/rules/SCR205.md.