OptimumCredo.Check.Warning.NarrowRandomRange (OptimumCredo v0.5.0)
View SourceBasics
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
A small random range collides sooner or later and causes flaky tests. Use UUIDs, or a timestamp plus a large random value, for uniqueness.
Bad: Enum.random(1..100) Good: System.unique_integer([:positive])
Check-Specific Parameters
Use the following parameters to configure this check:
:min_range
Ranges covering fewer values than this are reported.
This parameter defaults to 1000000.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.