File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ public extension Xccov.Converters {
13
13
14
14
public extension Xccov . Converters . SonarqubeXml {
15
15
static func convert( coverageReport: CoverageReport ) -> Result < String , Xccov . Error > {
16
+ Self . convert ( coverageReport: coverageReport,
17
+ currentDirectoryPath: FileManager . default. currentDirectoryPath)
18
+ }
19
+
20
+ static func convert( coverageReport: CoverageReport ,
21
+ currentDirectoryPath: String = FileManager . default. currentDirectoryPath) -> Result < String , Xccov . Error > {
16
22
let rootElement = XMLElement ( name: " coverage " )
17
23
rootElement. addAttribute ( XMLNode . nodeAttribute ( withName: " version " , stringValue: " 1 " ) )
18
24
@@ -23,7 +29,8 @@ public extension Xccov.Converters.SonarqubeXml {
23
29
24
30
25
31
allFiles. forEach { fileCoverageReport in
26
- let filePath = fileCoverageReport. path
32
+ // Define file path relative to source
33
+ let filePath = fileCoverageReport. path. replacingOccurrences ( of: currentDirectoryPath + " / " , with: " " )
27
34
28
35
let fileElement = XMLElement ( name: " file " )
29
36
fileElement. addAttribute ( XMLNode . nodeAttribute ( withName: " path " , stringValue: filePath) )
You can’t perform that action at this time.
0 commit comments