SCR117: redefined-builtin
Name shadows a builtin or Ignition's system
| Code | SCR117 |
| Name | redefined-builtin |
| Category | Scripts (SCR) |
| Default severity | info |
| Enabled by default | no |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports assignments, parameters, loop variables, functions, classes and
imports whose name is a Jython builtin (id, type, input, file,
max, ...) or Ignition's system, once per name and scope. Class
attributes and methods are not reported: methods do not see the class
body, so they do not hide the builtin anywhere else. Neither is the
exception class in except ValueError, TypeError:, which SCR115
reports.
Why is this bad?
Section titled “Why is this bad?”Inside that scope the builtin is no longer reachable: a later type(x)
or system.tag.readBlocking(...) calls the local value instead. The
failure appears far from the assignment.
Example
Section titled “Example”def onMessageReceived(self, payload): id = payload["id"] type = payload["type"] self.custom.label = "%s (%s)" % (id, type)Use instead:
def onMessageReceived(self, payload): itemId = payload["id"] itemType = payload["type"] self.custom.label = "%s (%s)" % (itemId, itemType)Options
Section titled “Options”allowed(default["__doc__", "__name__", "copyright", "credits", "exit", "help", "license", "quit"]): names that may be rebound.
pylint
Section titled “pylint”Corresponds to W0622 redefined-builtin.
Option reference
Section titled “Option reference”Set in [rules.SCR117] of iglint.toml (or [tool.iglint.rules.SCR117] in pyproject.toml).
| Option | Type | Default | Description |
|---|---|---|---|
allowed |
array of strings | ["__doc__", "__name__", "copyright", "credits", "exit", "help", "license", "quit"] |
Builtin names that may be rebound. |
Generated from the rule metadata by iglint generate-docs; iglint rule SCR117 prints the same page in the terminal. Source: docs/rules/SCR117.md.