ExQuality.Config (ExQuality v0.8.0)
View SourceLoads and merges configuration from multiple sources.
Configuration is resolved in the following order (later wins):
- Defaults
- Auto-detected tool availability
- Project config file (.quality.exs, read from the project root)
- CLI arguments
Example .quality.exs
[
# Global options
quick: false,
# Override auto-detection: force disable dialyzer
dialyzer: [enabled: false],
# Credo options (enabled: :auto by default)
credo: [
strict: true,
all: false
],
# Doctor options
doctor: [
summary_only: true
]
]Configuration Options
Global Options
quick- Quick mode: skip dialyzer and coverage enforcement (default: false)
Stage Options
Each stage supports:
enabled- :auto (use auto-detection) | true (force enable) | false (force disable)
Stage-specific options:
compile.warnings_as_errors- Treat warnings as errors (default: true)credo.strict- Use strict mode (default: true)credo.all- Check all files (default: false)dependencies.check_unused- Check for unused dependencies (default: true)dependencies.audit- Run security audit if available (default: :auto)doctor.summary_only- Show only summary (default: false)gettext.source_locale- The locale the source is written in, whose.pofiles are not checked (default:"en")gettext.exclude- Basenames to skip (default:["errors.po"])gettext.extract- Runmix gettext.extract --mergefirst, which writes to the repository and recompiles the project (default: false)sobelow.exit- Confidence level that blocks, when.sobelow-confsets noexit:of its own (default: "medium")sobelow.show_informational- Render findings below that level as well as counting them (default: false)test.coverage- :auto (measure when the project's config asks for it) | true (always measure) | false (never measure) (default: :auto)
Summary
Functions
Returns the path of the .quality.exs that applies here, or nil.
Returns the .quality.exs under project_root, or under umbrella_root
when the project has none of its own, or nil when neither has one.
Loads configuration with auto-detection and overrides.
Returns why a stage will not run, or nil when it will.
Determines if a stage should run based on config.
Functions
@spec config_path() :: String.t() | nil
Returns the path of the .quality.exs that applies here, or nil.
The file belongs to the project, not to wherever the shell happened to be
when mix quality was run. An umbrella child with no file of its own falls
back to the umbrella root's, because the settings describe the tree.
Finding the umbrella root needs Mix.Project.parent_umbrella_project_file/0,
which arrived in Elixir 1.15. On 1.14 only the current project's root is
looked at.
Returns the .quality.exs under project_root, or under umbrella_root
when the project has none of its own, or nil when neither has one.
Either root may be nil, meaning there is no such directory to look in.
Loads configuration with auto-detection and overrides.
Resolution order (later wins):
- Defaults
- Auto-detected tool availability
- .quality.exs file
- CLI arguments
Examples
# Load with CLI options
config = ExQuality.Config.load(quick: true, skip_dialyzer: true)
# Load with defaults only
config = ExQuality.Config.load()
Returns why a stage will not run, or nil when it will.
The reason is meant to be shown to the reader, because a stage that is silently omitted reads as a stage that passed.
Examples
config = ExQuality.Config.load(skip_credo: true)
ExQuality.Config.skip_reason(config, :credo)
#=> "--skip-credo"
config = ExQuality.Config.load()
ExQuality.Config.skip_reason(config, :doctor)
#=> ":doctor not installed"
Determines if a stage should run based on config.
enabled: :auto→ use detected availabilityenabled: true→ force enable (will error if tool missing)enabled: false→ force disable
Examples
config = ExQuality.Config.load()
ExQuality.Config.stage_enabled?(config, :credo)
#=> true (if credo is installed)
config = ExQuality.Config.load(skip_credo: true)
ExQuality.Config.stage_enabled?(config, :credo)
#=> false