jeremylong / violation-comments-lib

Library for commenting things with violations from static code analysis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Violation Comments Lib

Build Status Maven Central

This is a library that helps working with comments from static code analysis.

It supports the same formats as Violations Lib.

It is used by these libraries:

Template

It uses a template to render each violation comment. There is a default that can be replaced with a custom template.

The context available when the template is rendered is:

The templating language is Mustache and may look like:

**Reporter**: {{violation.reporter}}{{#violation.rule}}

**Rule**: {{violation.rule}}{{/violation.rule}}
**Severity**: {{violation.severity}}
**File**: {{changedFile.filename}} L{{violation.startLine}}{{#violation.source}}

**Source**: {{violation.source}}{{/violation.source}}

{{violation.message}}

You can avoid escaping (replaces new lines with 
) by using triple { like this:

{{{violation.message}}}

When using command line tools you may have problems with the ` (accent) character. You can do:

...
-comment-template "
message: 
\\\`\\\`\\\`
{{{violation.message}}}
\\\`\\\`\\\`
"

And it will surround the message with triple ```.

About

Library for commenting things with violations from static code analysis.

License:Apache License 2.0


Languages

Language:Java 100.0%