Skip to content

Commit

Permalink
Print proper counts from the reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
nicorichard committed Jun 12, 2024
1 parent 0d1f9e1 commit 17525da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ struct CommandLineReporter: Reporter {
}
}

let errors = results.flatMap { result in
let validations = results.flatMap { result in
result.validations
}
.filter { $0.rule.severity == .error }

let errors = validations.filter { $0.rule.severity == .error }

if !errors.isEmpty {
print("Found \(results.count) total xcstringlint issues, \(errors.count) serious")
print("Found \(results.count) total xcstringlint issues in \(results.count) keys, \(errors.count) serious")
throw ExitCode.failure
} else if !results.isEmpty {
print("Found \(results.count) total xcstringlint issues")
print("Found \(results.count) total xcstringlint issues in \(results.count) keys")
}
}
}
9 changes: 5 additions & 4 deletions Sources/XCStringsLint/services/Reporter/XcodeReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ struct XcodeReporter: Reporter {
}
}

let errors = results.flatMap { result in
let validations = results.flatMap { result in
result.validations
}
.filter { $0.rule.severity == .error }

let errors = validations.filter { $0.rule.severity == .error }

if !errors.isEmpty {
print(level: .error, "Found \(results.count) total xcstringlint issues, \(errors.count) serious")
print(level: .error, "Found \(validations.count) total xcstringlint issues in \(results.count) keys, \(errors.count) serious")
throw ExitCode.failure
} else if !results.isEmpty {
print(level: .warning, "Found \(results.count) total xcstringlint issues")
print(level: .warning, "Found \(validations.count) total xcstringlint issues in \(results.count) keys")
}
}
}
Expand Down

0 comments on commit 17525da

Please sign in to comment.