KogenCredo.Diff.Finding (KogenCredo v0.1.0)
View SourceOne rule hit, with text, JSON and GitHub workflow-command renderings.
Severity is :advisory (printed, never fails by default) or :error.
GitHub escaping follows the workflow-command rules: in the message %, \r and \n are
escaped; in properties (file, title) : and , are escaped as well.
Summary
Functions
Makes text safe to print as one line: control characters (newlines, escapes, NUL) become
\xNN, and surrounding whitespace is trimmed. CI log processors act on lines that start with
::, so repository-controlled text (paths, parser messages, git stderr) must not be able to
start a line of its own.
Builds a finding anchored at the changed function.
One-line text form.
Builds an annotation line from raw parts, escaping each part.
GitHub annotation line (::warning file=...,line=...,title=...::message).
JSON object for one finding.
Map with string keys, ready for JSON.
Types
Functions
Makes text safe to print as one line: control characters (newlines, escapes, NUL) become
\xNN, and surrounding whitespace is trimmed. CI log processors act on lines that start with
::, so repository-controlled text (paths, parser messages, git stderr) must not be able to
start a line of its own.
@spec for_change(String.t(), KogenCredo.Diff.Change.t(), String.t()) :: t()
Builds a finding anchored at the changed function.
One-line text form.
@spec github_line( String.t(), String.t() | nil, integer() | nil, String.t(), String.t() ) :: String.t()
Builds an annotation line from raw parts, escaping each part.
GitHub annotation line (::warning file=...,line=...,title=...::message).
JSON object for one finding.
Map with string keys, ready for JSON.