Mix.Task.Compiler.Diagnostic

Diagnostic information such as a warning or compilation error.

Summary

Types

position()

Where in a file the diagnostic applies. Can be either a line number, a range specified as {start_line, start_col, end_line, end_col}, or nil if unknown

severity()

Severity of a diagnostic

t()

Types

position()

position() ::
  nil
  | pos_integer()
  | {pos_integer(), non_neg_integer(), pos_integer(), non_neg_integer()}

Where in a file the diagnostic applies. Can be either a line number, a range specified as {start_line, start_col, end_line, end_col}, or nil if unknown.

Line numbers are 1-based, and column numbers in a range are 0-based and refer to the cursor position at the start of the character at that index. For example, to indicate that a diagnostic applies to the first n characters of the first line, the range would be {1, 0, 1, n}.

severity()

severity() :: :error | :warning | :information | :hint

Severity of a diagnostic:

  • :error - An issue that caused compilation to fail

  • :warning - An issue that did not cause failure but suggests the programmer may have made a mistake

  • :hint - A suggestion for style or good practices that is not as severe as a warning

  • :information - Any other information relevant to compilation that does not fit into the above categories

t()

t() :: %Mix.Task.Compiler.Diagnostic{
  compiler_name: String.t(),
  details: any(),
  file: Path.t(),
  message: String.t(),
  position: position(),
  severity: severity()
}

© 2012 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/mix/1.6.6/Mix.Task.Compiler.Diagnostic.html