ExSlop.Check.Warning.PathExpandPriv (ExSlop v0.4.1)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of normal and works with any version of Elixir.

Explanation

Using Path.expand("...priv...", __DIR__) to locate application resources is fragile — it depends on the source layout and breaks in releases. Use Application.app_dir/2 instead.

# bad — fragile, breaks in releases
Path.expand("../../priv/prompts/system.md", __DIR__)

# good — works in dev, test, and releases
Application.app_dir(:my_app, "priv/prompts/system.md")

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.