Skip to content

REF012: unused-library-function

Library function is never referenced

Code REF012
Name unused-library-function
Category References (REF)
Default severity info
Enabled by default no
Fix available no
ign-lint equivalent none

Reports top-level functions of project library modules that nothing in the project references: no script (views, event scripts, tag event scripts of the gateway, other library modules, the module itself) uses core.util.fn, from core.util import fn or an alias of it, also through another library module's import (m0.util.fn when m0 does from core import util), and no expression calls runScript("core.util.fn").

The rule stays silent for a module whose names may be reached in ways that cannot be followed: the module (or its package) used as a value (passed to a function, getattr(core.util, name), vars(core.util), core.util.__dict__), star-imported, a module that may rebind its own names at run time (exec, writes through globals(), code that reads or writes a frame's or a module's names by itself such as sys._getframe() or e = eval; reflection that is only a first hop, such as a .type Java member or getattr with a computed name, does not count, see docs/internal/fix-safety.md, "Frame routes: findings and fixes"), a function that a later from x import * may overwrite, or a project with non-literal runScript, __import__, eval or exec targets. It also stays silent in inheritable projects, in projects whose parent is not in the workspace and in projects with resources whose scripts are not analysed (Vision windows and templates, reports, alarm pipelines, SFC charts, event streams).

Unused functions are dead code that still has to be read and maintained. This rule is not in the default set: functions are also called from other projects through the gateway and by name from configuration.

A function core.util.oldFormat that no script calls any more. Delete it.


Generated from the rule metadata by iglint generate-docs; iglint rule REF012 prints the same page in the terminal. Source: docs/rules/REF012.md.