KogenCredo.Check.Warning.UnboundedWait (KogenCredo v0.1.0)

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

A receive without after, or a call with timeout :infinity, turns a lost message or a crashed peer into a hang that only a CI timeout will end. Use a finite deadline (and handle the timeout) so the failure is reported where it happens.

Check-Specific Parameters

Use the following parameters to configure this check:

:included_paths

Only files under these path prefixes are checked.

This parameter defaults to ["lib/", "test/"].

:excluded_paths

Files under these path prefixes are skipped.

This parameter defaults to [].

:flag_receive_without_after

Report receive blocks that have no after clause.

This parameter defaults to true.

:flag_timeout_option

Report timeout: :infinity keyword options.

This parameter defaults to true.

:infinity_calls

{Module, :function, timeout_arg_index} entries where :infinity is reported.

This parameter defaults to [{GenServer, :call, 2}, {GenServer, :stop, 2}, {Task, :await, 1}, {Task, :yield, 1}, {Task, :await_many, 1}, {Agent, :get, 2}, {Agent, :get_and_update, 2}, {Agent, :update, 2}, {Agent, :stop, 2}, {Supervisor, :stop, 2}, {Process, :sleep, 0}, {:timer, :sleep, 0}, {:gen_server, :call, 2}].

General Parameters

Like with all checks, general params can be applied.

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