-
Notifications
You must be signed in to change notification settings - Fork 5
/
XCResultParsingConfiguration.swift
73 lines (58 loc) · 2.04 KB
/
XCResultParsingConfiguration.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// XCResultParsingConfiguration.swift
//
//
// Created by 史 翔新 on 2022/02/10.
//
import Foundation
public struct XCResultParsingConfiguration {
public typealias RelativeFilePath = String
public enum ReportingFileType {
case all
case modifiedAndCreatedFiles
case custom(predicate: (RelativeFilePath) -> Bool)
}
public enum CodeCoverageRequirement {
public struct CoverageThreshold {
public var acceptable: Double
public var recommended: Double
public init(acceptable: Double, recommended: Double) {
self.acceptable = acceptable
self.recommended = recommended
}
}
case none
case required(CoverageThreshold)
}
public var parseBuildWarnings: Bool
public var parseBuildErrors: Bool
public var parseAnalyzerWarnings: Bool
public var parseTestFailures: Bool
public var codeCoverageRequirement: CodeCoverageRequirement
public var reportingFileType: ReportingFileType
public init(
parseBuildWarnings: Bool = true,
parseBuildErrors: Bool = true,
parseAnalyzerWarnings: Bool = true,
parseTestFailures: Bool = true,
codeCoverageRequirement: CodeCoverageRequirement = .required(.init(acceptable: 0, recommended: 0.6)),
reportingFileType: ReportingFileType = .all
) {
self.parseBuildWarnings = parseBuildWarnings
self.parseBuildErrors = parseBuildErrors
self.parseAnalyzerWarnings = parseAnalyzerWarnings
self.parseTestFailures = parseTestFailures
self.codeCoverageRequirement = codeCoverageRequirement
self.reportingFileType = reportingFileType
}
}
extension XCResultParsingConfiguration {
public static var `default`: XCResultParsingConfiguration {
.init()
}
}
extension XCResultParsingConfiguration {
var needsIssues: Bool {
parseBuildWarnings || parseBuildErrors || parseAnalyzerWarnings || parseTestFailures
}
}