Renders Composer.Lint.Diagnostics for mix composer.cookbook.lint.
Every function is pure: it returns text and prints nothing.
text/1- the default: full messages, each after apath:line:col:location (relative to the current directory)compact/2- one line per diagnostic,file:line:col: severity: message [code], absolute paths, the message folded onto one line. The equivalent of Credo'sflycheckandonelineformats, for editors.json/1- an array ofDiagnostic.to_map/1github/2- GitHub Actions workflow commands (annotations)
compact/2 and github/2 never print a line without a location: a
diagnostic that has none is printed at :1:1 of its first related
file, or else of the fallback path.
Summary
Functions
One line per diagnostic: file:line:col: severity: message [code].
Folds a message onto one line: indented code blocks (lines indented by four spaces after a blank line) are dropped, and every run of whitespace becomes one space.
GitHub Actions workflow commands: ::error file=…,line=…,col=…,…::message.
Paths are relative to the current directory, as GitHub matches them to
the repository.
The diagnostics as a pretty JSON array.
The text format: %{errors: [...], warnings: [...]}, each a full
message after its location.
Functions
@spec compact([Composer.Lint.Diagnostic.t()], Path.t() | nil) :: String.t()
One line per diagnostic: file:line:col: severity: message [code].
Folds a message onto one line: indented code blocks (lines indented by four spaces after a blank line) are dropped, and every run of whitespace becomes one space.
@spec github([Composer.Lint.Diagnostic.t()], Path.t() | nil) :: String.t()
GitHub Actions workflow commands: ::error file=…,line=…,col=…,…::message.
Paths are relative to the current directory, as GitHub matches them to
the repository.
@spec json([Composer.Lint.Diagnostic.t()]) :: String.t()
The diagnostics as a pretty JSON array.
@spec text([Composer.Lint.Diagnostic.t()]) :: %{ errors: [String.t()], warnings: [String.t()] }
The text format: %{errors: [...], warnings: [...]}, each a full
message after its location.