SCR121: global-at-module-level
global statement at module level
| Code | SCR121 |
| Name | global-at-module-level |
| Category | Scripts (SCR) |
| Default severity | info |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports global statements at the top level of a library module.
Why is this bad?
Section titled “Why is this bad?”At module level every name is already global; the statement does nothing.
It often signals a misunderstanding: Ignition library modules are loaded
once per project and their module-level variables are shared by every
caller, which global does not change.
Inside Perspective and event scripts global is not at module level (the
script is a function body) and is not reported.
Example
Section titled “Example”global cachecache = {}Use instead:
cache = {}pylint
Section titled “pylint”Corresponds to W0604 global-at-module-level.
Generated from the rule metadata by iglint generate-docs; iglint rule SCR121 prints the same page in the terminal. Source: docs/rules/SCR121.md.