ClientUtils.Check.SpexDeniedCalls (client_utils v0.7.3)

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

Universal function-level denies for BDD spec files (_spex.exs).

It ships in client_utils for every project. It carries the function-level denies that hold for every project (shell escape, dynamic dispatch, VM mutation, dynamic code eval). Project-specific WHOLE-module denies (File, Port, :file, and any app contexts the spec boundary shouldn't reach) belong in .code_my_spec/credo_checks/local/, not here.

Function-level denies (the rest of the module is fine):

  • System.cmd/2,3, System.shell/1,2 — shelling out.
  • System.halt, System.stop, System.at_exit, System.put_env, System.delete_env, System.restart — VM/env mutation.
  • :os.cmd/1 — shelling out via Erlang.
  • Code.eval_*, Code.compile_string, Code.compile_quoted, Code.require_file — dynamic code evaluation.
  • Kernel.apply/2,3 — dynamic dispatch escape hatch.

Whole-module denies belong in a project-local check — see the spex_boundary_ready workflow.

If a spec needs shell execution or dynamic dispatch to make a scenario work, the scenario is almost certainly wrong — re-read .code_my_spec/knowledge/bdd/spex/boundaries.md before reaching for one of these.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

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