OptimumCredo.Check.Warning.DescribeWithoutErrorCase (OptimumCredo v0.5.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

Test the sad path next to the happy path: not-found, invalid and unauthorised cases. This heuristic only looks for textual hints and is meant as a prompt for review.

Check-Specific Parameters

Use the following parameters to configure this check:

:min_tests

Describes with fewer tests are skipped.

This parameter defaults to 2.

:error_words

Case-insensitive whole words or phrases in a test name or identifier that indicate a sad path.

This parameter defaults to ["error", "invalid", "fail", "not", "not found", "unauthorized", "forbidden", "reject", "denied", "missing", "cannot", "raise", "non-existent", "nonexistent", "non-existing", "nonexisting", "does not exist", "doesn't exist", "expired", "unknown"].

:error_atoms

Atoms in a test body that indicate a sad path.

This parameter defaults to [:error, :unauthorized, :forbidden, :not_found, :invalid, :unprocessable_entity, :bad_request, :conflict, :internal_server_error].

:ignore_paths

Path fragments to skip.

This parameter defaults to ["test/support/"].

General Parameters

Like with all checks, general params can be applied.

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