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

@tag :tmp_dir makes ExUnit create tmp/<Module>/<test> under the working directory, which is the project tree. Writes to project-relative paths or to File.cwd!/0 pollute it as well, and a polluted tree breaks "clean tree after tests" gates. Build a unique directory under System.tmp_dir!/0 and remove it in on_exit/1, or take the path from the test's setup.

Check-Specific Parameters

Use the following parameters to configure this check:

:included_paths

Only files under these path prefixes are checked (default test/).

This parameter defaults to ["test/"].

:excluded_paths

Files under these path prefixes are skipped.

This parameter defaults to [].

:allow_tmp_dir_paths

Test files allowed to use :tmp_dir: directory prefixes, path suffixes or */** globs.

This parameter defaults to [].

:allow_write_paths

Test files allowed to write into the project tree: directory prefixes, path suffixes or */** globs.

This parameter defaults to [].

General Parameters

Like with all checks, general params can be applied.

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