Skip to main content

Search 436 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML format

Checkstyle report

One file element per source file, one error element per finding — the de facto interchange format for linters far beyond Java.

Checkstyle's output format outgrew Checkstyle. ESLint, PHP_CodeSniffer, Stylelint, golangci-lint and a long tail of others all emit it, because it is the format Jenkins, GitLab and most code-quality dashboards were already reading. If a linter offers exactly one XML format, this is usually it.

It is small enough to be worth knowing by heart: a <checkstyle> root, a <file name> per source file, and an <error> per finding with line, column, severity, message and source. That simplicity is the reason it spread, and also the reason it carries no fix information — which is what SARIF was designed to add.

Constraints that bite

  • A file with no findings still appears, as an empty <file> element. Counting <file> elements does not count problems.
  • severity is conventionally error, warning or info, but nothing enforces the set and tools emit their own.
  • Line and column numbers are 1-based, and column is often absent rather than zero.
  • The name attribute is whatever path the tool was invoked with — absolute on most CI runners, which leaks the build directory into the report.
  • There is no place for a suggested fix or a rule description, which is the gap SARIF fills.
Root element
<checkstyle>
Media type
application/xml
Extensions
.xml
Namespaces
None — unqualified elements
XMLDir label

Specification: Checkstyle XMLLogger

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

checkstyle-report.xml
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="10.17.0">
  <file name="src/main/java/com/example/Order.java">
    <error line="14" column="5" severity="warning"
           message="Missing a Javadoc comment."
           source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
    <error line="27" column="1" severity="error"
           message="Line is longer than 120 characters (found 134)."
           source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
  </file>
  <file name="src/main/java/com/example/Line.java"/>
</checkstyle>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.