Unused local method (UnusedLocalMethod)¶
| Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
|---|---|---|---|---|---|
Code smell |
BSLOS |
Major |
Yes |
1 |
standardsuspiciousunused |
Parameters¶
| Name | Type | Description | Default value |
|---|---|---|---|
attachableMethodPrefixes |
String |
Method prefixes (comma separated) |
подключаемый_,attachable_ |
checkObjectModule |
Boolean |
Check object modules |
false |
Description¶
Modules should not have unused procedures and functions. Diagnostics can skip attachable methods that have prefixes specified in the diagnostic parameter.
Event handlers are not reported as unused: the platform calls them itself, so there is no call in the module body. In a managed form module, handlers are the procedures declared by the form — its own events, its items' events and command actions.
The diagnostic does not run:
- in an ordinary form module — its events are not modelled in the context, so a handler would be indistinguishable from a forgotten method;
- in a module whose type could not be determined — that is how a single file opened outside a project looks: the module owner, and therefore its events, are invisible, so every handler would look like a method nobody calls.
Sources¶
- Source: Standard: Modules (RU)
Snippets¶
Diagnostic ignorance in code¶
// BSLLS:UnusedLocalMethod-off
// BSLLS:UnusedLocalMethod-on
Parameter for config¶
"UnusedLocalMethod": {
"attachableMethodPrefixes": "подключаемый_,attachable_",
"checkObjectModule": false
}