Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Feature: Add support for fatal lint #105

Merged
merged 2 commits into from
May 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CollectLintViolationsTask extends CollectViolationsTask {
@Override
void collectViolations(File xmlReportFile, File htmlReportFile, Violations violations) {
GPathResult xml = new XmlSlurper().parse(xmlReportFile)
int errors = xml.'**'.findAll { node -> node.name() == 'issue' && node.@severity == 'Error' }.size()
int errors = xml.'**'.findAll { node -> node.name() == 'issue' && (node.@severity == 'Error' || node.@severity == 'Fatal') }.size()
int warnings = xml.'**'.findAll { node -> node.name() == 'issue' && node.@severity == 'Warning' }.size()
violations.addViolations(errors, warnings, htmlReportFile ?: xmlReportFile)
}
Expand Down
3 changes: 3 additions & 0 deletions plugin/src/test/fixtures/reports/lint/lint-results.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 3.0.1">

<issue id="StopShip" severity="Fatal" message="Code contains STOPSHIP marker" category="Correctness"
priority="10" summary="Code contains STOPSHIP marker"/>

<issue
id="MissingSuperCall"
severity="Error"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CollectLintViolationsTaskTest {
Violations violations = new Violations('Android Lint')
task.collectViolations(Fixtures.Lint.SAMPLE_REPORT, null, violations)

assertThat(violations.getErrors()).isEqualTo(1)
assertThat(violations.getErrors()).isEqualTo(2)
assertThat(violations.getWarnings()).isEqualTo(1)
}
}