OeditusCredo.Check.Readability.UnnecessaryInterpolatingSigil
(OeditusCredo v0.6.3)
View Source
Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Detects lowercase (interpolating) sigils that contain no interpolation.
When a sigil body has no #{} expressions and no backslash escape
sequences, the lowercase variant (~s, ~c, ~w) behaves identically
to its uppercase counterpart (~S, ~C, ~W), but misleads the
reader into expecting dynamic content.
Bad:
html = ~s"<div class=\"box\">static</div>"
words = ~w"foo bar baz"Good:
html = ~S"<div class=\"box\">static</div>"
words = ~W"foo bar baz"This is especially important inside raw/1 and Phoenix.HTML.raw/1,
where ~S makes it clear the content is a compile-time literal and
not user input (see OeditusCredo.Check.Security.XSSVulnerability).
Check-Specific Parameters
Use the following parameters to configure this check:
:exclude_test_files
Set to true to skip test files (default: false)
This parameter defaults to nil.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.