CheckStyle Pipe not seeing any issues present in xml file

thinkspill January 19, 2021

Sample input (fake-php-cs.xml):

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="3.5.8">
<file name="app/Services/NewRelic.php">
<error line="2" column="1" severity="error" message="Missing file doc comment" source="PEAR.Commenting.FileComment.Missing"/>
</file>
</checkstyle>

 

Pipeline:

after-script:
- pipe: atlassian/checkstyle-report:0.2.1
variables:
CHECKSTYLE_RESULT_PATTERN: 'fake-php-cs.xml'
DEBUG: 'true' # please document this flag

 

Pipeline Log Output:

<docker run flags, image pulling, etc>
Submitted report. Response:200 OK
Request URI:http://api.bitbucket.org/2.0/repositories/my/repo/commit/myhash/reports/checkstyle-1
Request Body -------
{"title":"Checkstyle","details":"Checkstyle report","external_id":"checkstyle-1","report_type":"BUG","result":"PASSED","data":[{"title":"Violations","type":"NUMBER","value":0},{"title":"Low Severity","type":"NUMBER","value":0},{"title":"Medium Severity","type":"NUMBER","value":0},{"title":"High Severity","type":"NUMBER","value":0}]}
--------------------
Response Body ------
{"result": "PASSED", "uuid": "{my_uuid}", "title": "Checkstyle", "remote_link_enabled": false, "type": "report", "created_on": "2021-01-19T22:50:47.580890Z", "details": "Checkstyle report", "report_type": "BUG", "updated_on": "2021-01-19T22:50:47.580890Z", "data": [{"title": "Violations", "type": "NUMBER", "value": 0}, {"title": "Low Severity", "type": "NUMBER", "value": 0}, {"title": "Medium Severity", "type": "NUMBER", "value": 0}, {"title": "High Severity", "type": "NUMBER", "value": 0}], "external_id": "checkstyle-1"}
--------------------

 

Report Output:

Screen Shot 2021-01-19 at 2.37.10 PM.png

 

I have tried all variations of relative and absolute path references that I could imagine might work, all resulting in the same empty report.

Please let me know if I missed something. Thanks!

1 answer

1 accepted

0 votes
Answer accepted
thinkspill January 19, 2021

Ok, I found the issue.

CHECKSTYLE_RESULT_PATTERN must be in regex form, like so:

CHECKSTYLE_RESULT_PATTERN: '.*/fake-php-cs.xml$'

 A simple path reference will not work.

 

Thank you for making this pipe!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events