KogenCredo.Check.Warning.FailOpenWith (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

Let with return the non-matching value as-is (no else), or match the exact error shapes the clauses can produce and translate them. Never invent a result for a value you did not expect, and never let {:error, reason} become nil, [] or :ok: the caller cannot tell "nothing found" from "the read failed".

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/"].

:excluded_paths

Files under these path prefixes are skipped.

This parameter defaults to [].

:flag_case

Also report {:error, _} -> constant clauses in plain case expressions.

This parameter defaults to true.

:flag_identity_else

Report else blocks that only return what they matched.

This parameter defaults to true.

General Parameters

Like with all checks, general params can be applied.

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