terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.88k stars 354 forks source link

formatter: Add source attribute in the checkstyle format #2078

Closed wata727 closed 2 months ago

wata727 commented 3 months ago

Fixes https://github.com/terraform-linters/tflint/issues/2056

Currently, the checkstyle output format uses the rule attribute as the rule name.

$ tflint --format checkstyle
<checkstyle>
  <file name="test.tf">
    <error rule="test_rule" line="1" column="1" severity="error" message="test" link="https://github.com"></error>
  </file>
</checkstyle>

However, the original Checkstyle XML output format uses the source attribute as the issue identifier. https://github.com/checkstyle/checkstyle/blob/a7042e5119e6df9b8f782751af6cae2ee54a215a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java#L205-L224

Several tools rely on the original format shown above, so TFLint adds the source attribute as well.

The rule attribute will remain for backwards compatibility, but will be removed in the future. Tools that rely on its value are encouraged to switch to the source attribute as soon as possible.