dialyzer-configuration
Use when configuring Dialyzer for Erlang/Elixir type checking and static analysis.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Dialyzer Configuration
Dialyzer is a static analysis tool for Erlang and Elixir that identifies software discrepancies such as type errors, unreachable code, and unnecessary tests.
Configuration Files
dialyzer.ignore-warnings
# Ignore specific warnings
lib/my_module.ex:42:pattern_match_cov
.dialyzer_ignore.exs
[
{"lib/generated_code.ex", :no_return},
{~r/lib\/legacy\/.*/, :unknown_function}
]
mix.exs Configuration
def project do
[
app: :my_app,
dialyzer: [
plt_add_apps: [:mix, :ex_unit],
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
flags: [:error_handling, :underspecs, :unmatched_returns],
ignore_warnings: ".dialyzer_ignore.exs",
list_unused_filters: true
]
]
end
Common Configuration Options
PLT Management
-
plt_add_apps: Additional applications to include in PLT -
plt_core_path: Directory for core PLT files -
plt_file: Custom PLT file location -
plt_add_deps: Include dependencies (:app_tree,:apps_direct,:transitive)
Analysis Flags
-
:error_handling- Check error handling -
:underspecs- Warn on under-specified functions -
:unmatched_returns- Warn on unmatched return values -
:unknown- Warn on unknown functions/types -
:overspecs- Warn on over-specified functions
Filter Options
-
ignore_warnings: File with warning patterns to ignore -
list_unused_filters: Show unused ignore patterns
Best Practices
- Incremental PLT Building: Use project-specific PLTs to speed up analysis
- Gradual Adoption: Start with subset of checks, expand over time
- CI Integration: Run Dialyzer in continuous integration
- Type Specs: Add comprehensive @spec annotations
- Warning Management: Document intentional ignores
Common Patterns
Conditional Analysis
if Mix.env() in [:dev, :test] do
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
end
Custom Check Script
#!/bin/bash
mix dialyzer --format github
GitHub Actions Integration
- name: Run Dialyzer
run: mix dialyzer --format github
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-02-04
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!