Prefer Sigils

View Source

Since Erlang/OTP 27+, prefer sigil syntax for UTF-8 text that would otherwise be written as a plain binary string literal (a single string segment inside << >>). The rule does nothing on older OTP releases.

Avoid

<<"hello">>

(and other <<"...">> forms that contain only one string segment—the kind the rule flags.)

Prefer

~"hello"

Multiline and other delimiters follow the general sigil rules; for example:

~"""
hello
world
"""

Rationale

Sigils (see EEP 66) make string and binary literals easier to read and to refactor: you can pick delimiters to reduce escaping, express multiline text clearly, and align with modern Erlang style. Binary literals built from a single string segment are a natural place to adopt them first.

Options

  • None.

Example configuration

{elvis_style, prefer_sigils, #{}}