DialyzerJson.FixHint (dialyzer_json v0.2.0)

Copy Markdown View Source

Classifies dialyzer warning types into fix categories.

Categories help AI editors prioritize which warnings to fix first:

  • "spec" - Likely needs typespec fix. The code is probably correct, but the @spec doesn't match what dialyzer inferred.

  • "code" - Likely a real bug. The code has a problem that should be fixed, such as unreachable code, impossible pattern matches, or invalid calls.

  • "pattern" - Common safe-to-ignore pattern. Often intentional or caused by third-party code (e.g., missing behaviour info, unused functions).

Summary

Types

Fix hint category string.

Functions

Returns a list of all known warning types.

Returns the fix hint for a warning type.

Returns warning types for a given category.

Types

hint()

@type hint() :: String.t()

Fix hint category string.

Possible values: "spec", "code", "pattern", "unknown"

Functions

all_warning_types()

@spec all_warning_types() :: [atom()]

Returns a list of all known warning types.

classify(warning_type)

@spec classify(atom()) :: hint()

Returns the fix hint for a warning type.

Examples

iex> DialyzerJson.FixHint.classify(:contract_diff)
"spec"

iex> DialyzerJson.FixHint.classify(:call)
"code"

iex> DialyzerJson.FixHint.classify(:unused_fun)
"pattern"

iex> DialyzerJson.FixHint.classify(:unknown_warning_type)
"unknown"

warning_types_for(arg1)

@spec warning_types_for(hint()) :: [atom()]

Returns warning types for a given category.

Examples

iex> :contract_diff in DialyzerJson.FixHint.warning_types_for("spec")
true