Ambient.Credo.NoDirectRandom (Ambient v0.1.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

Direct randomness reads bypass the RNG seed and make code paths flaky-by-design. Route through your RNG wrapper. Crypto-grade randomness for tokens (:crypto.strong_rand_bytes/1) is allowed.

Check-Specific Parameters

Use the following parameters to configure this check:

:replacement

Your RNG wrapper module name, shown in the message.

This parameter defaults to "Ambient.Random".

:exempt_suffixes

File path suffixes exempt from the check.

This parameter defaults to ["lib/ambient/random.ex"].

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.