Fixed display of optin and correctable (#4841)

Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
This commit is contained in:
Martin Redington 2023-03-27 06:48:51 +01:00 committed by GitHub
parent efc5afd5d5
commit 5a91b1e392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 12 deletions

View File

@ -70,8 +70,8 @@ private extension TextTable {
addRow(values: [
ruleIdentifier,
rule is OptInRule ? "yes" : "no",
rule is CorrectableRule ? "yes" : "no",
rule is OptInRule.Type ? "yes" : "no",
rule is CorrectableRule.Type ? "yes" : "no",
rule == nil ? "yes" : "no",
numberOfWarnings.formattedString.leftPadded(forHeader: numberOfWarningsHeader),
numberOfErrors.formattedString.leftPadded(forHeader: numberOfErrorsHeader),

View File

@ -160,7 +160,12 @@ class ReporterTests: XCTestCase {
func testSummaryReporter() {
let expectedOutput = stringFromFile("CannedSummaryReporterOutput.txt")
.trimmingTrailingCharacters(in: .whitespacesAndNewlines)
let result = SummaryReporter.generateReport(generateViolations())
let correctableViolation = StyleViolation(
ruleDescription: VerticalWhitespaceOpeningBracesRule.description,
location: Location(file: "filename", line: 1, character: 2),
reason: "Violation Reason"
)
let result = SummaryReporter.generateReport(generateViolations() + [correctableViolation])
XCTAssertEqual(result, expectedOutput)
}

View File

@ -1,9 +1,10 @@
+-----------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| rule identifier | opt-in | correctable | custom | warnings | errors | total violations | number of files |
+-----------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| line_length | no | no | no | 1 | 1 | 2 | 1 |
| colon | no | no | no | 0 | 1 | 1 | 1 |
| syntactic_sugar | no | no | no | 0 | 1 | 1 | 1 |
+-----------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| Total | | | | 1 | 3 | 4 | 2 |
+-----------------+--------+-------------+--------+----------+--------+------------------+-----------------+
+------------------------------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| rule identifier | opt-in | correctable | custom | warnings | errors | total violations | number of files |
+------------------------------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| line_length | no | no | no | 1 | 1 | 2 | 1 |
| colon | no | yes | no | 0 | 1 | 1 | 1 |
| syntactic_sugar | no | yes | no | 0 | 1 | 1 | 1 |
| vertical_whitespace_opening_braces | yes | yes | no | 1 | 0 | 1 | 1 |
+------------------------------------+--------+-------------+--------+----------+--------+------------------+-----------------+
| Total | | | | 2 | 3 | 5 | 2 |
+------------------------------------+--------+-------------+--------+----------+--------+------------------+-----------------+