Docs
Linting rules

S005: message-should-be-named

Checks for messages created with `createMessage(...)` but named as generic `msg` or `message`.

Metadata

  • Code: S005
  • Rule: message-should-be-named
  • Status: Stable since v0.0.1
  • Quick fix: not available

What it does

Checks for messages created with createMessage(...) but named as generic msg or message.

Why is this bad?

Messages are first-class entities in Tolk and should have meaningful names. Generic names like msg and message make code harder to read and reason about.

Example

val msg = createMessage({ ... });
S005: message should be properly named
msg.send(SEND_MODE_REGULAR);

Use instead:

val deployMessage = createMessage({ ... });
deployMessage.send(SEND_MODE_REGULAR);

Behavior notes

The rule checks local variables named exactly msg or message whose initializer resolves to createMessage(...).

Source code

Last updated on

On this page