VIEW008: empty-script
Perspective script with an empty body
| Code | VIEW008 |
| Name | empty-script |
| Category | View structure (VIEW) |
| Default severity | error |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports a Perspective script whose body is empty or only whitespace: script actions, script transforms, property change scripts, message handlers, custom methods and extension functions, in views and session properties. Disabled change scripts, disabled actions and disabled extension functions are not compiled and are not reported.
Why is this bad?
Section titled “Why is this bad?”Ignition compiles the body inside a generated def line. An empty body is
an IndentationError ("expected an indented block"): the action does
nothing, the transform makes its binding fail, the handler never runs, and
the gateway logs an error each time.
Example
Section titled “Example”"onActionPerformed": {"type": "script", "scope": "G", "config": {"script": ""}}Use instead: remove the action, or give it a body (pass if it is a
placeholder):
"onActionPerformed": {"type": "script", "scope": "G", "config": {"script": "\tpass"}}Generated from the rule metadata by iglint generate-docs; iglint rule VIEW008 prints the same page in the terminal. Source: docs/rules/VIEW008.md.