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

A global name (PubSub topic, named ETS table, registered process name) makes every test that touches it share state with every other test. Accept an option with a default so tests can pass a unique name.

Reported:

Phoenix.PubSub.broadcast(MyApp.PubSub, "drops", msg)
:ets.new(:cache, [:named_table])
GenServer.start_link(__MODULE__, opts, name: __MODULE__)

Check-Specific Parameters

Use the following parameters to configure this check:

:kinds

Kinds of names to report.

This parameter defaults to [:topic, :ets, :persistent_term, :process_name].

:allowed_names

Names accepted as global.

This parameter defaults to [].

:included_files

Path globs of files to check.

This parameter defaults to ["lib/**/*.ex"].

General Parameters

Like with all checks, general params can be applied.

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