KogenCredo.Check.Warning.SharedResourceGroup (KogenCredo v0.1.0)
View SourceBasics
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
Async modules that touch the same global resource (env key, named ETS
table, fixed path, PubSub topic) must be in the same group: so they run
one after another.
Bad: two async: true modules both call Application.put_env(:app, :mode, ..).
Good: both use use ExUnit.Case, async: true, group: :app_mode.
Check-Specific Parameters
Use the following parameters to configure this check:
:case_templates
Map of case template module name => :inherit | :async | :serial.
This parameter defaults to %{}.
:kinds
Resource kinds compared across modules.
This parameter defaults to [:env, :ets, :file, :topic, :persistent_term].
:included_files
Path globs of files to check.
This parameter defaults to ["test/**/*_test.exs"].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.
Summary
Functions
Pure analysis. Returns [%{filename, line, trigger, message, resource, module}].
Functions
@spec analyze( [Credo.SourceFile.t()], keyword() ) :: [map()]
Pure analysis. Returns [%{filename, line, trigger, message, resource, module}].
params takes the same keys as the check (:case_templates, :kinds,
:included_files); missing keys use the defaults.