diff --git a/Sources/PeripheryKit/Formatters/CsvFormatter.swift b/Sources/PeripheryKit/Formatters/CsvFormatter.swift index df7f72c60..4bcb55193 100644 --- a/Sources/PeripheryKit/Formatters/CsvFormatter.swift +++ b/Sources/PeripheryKit/Formatters/CsvFormatter.swift @@ -63,7 +63,7 @@ final class CsvFormatter: OutputFormatter { let joinedModifiers = attributes.joined(separator: "|") let joinedAttributes = modifiers.joined(separator: "|") let joinedUsrs = usrs.joined(separator: "|") - let path = outputPath(location) + let path = locationDescription(location) return "\(kind),\(name ?? ""),\(joinedModifiers),\(joinedAttributes),\(accessibility ?? ""),\(joinedUsrs),\(path),\(hint ?? "")" } } diff --git a/Sources/PeripheryKit/Formatters/JsonFormatter.swift b/Sources/PeripheryKit/Formatters/JsonFormatter.swift index 28036a7e9..ccfabc932 100644 --- a/Sources/PeripheryKit/Formatters/JsonFormatter.swift +++ b/Sources/PeripheryKit/Formatters/JsonFormatter.swift @@ -23,7 +23,7 @@ final class JsonFormatter: OutputFormatter { "accessibility": result.declaration.accessibility.value.rawValue, "ids": Array(result.declaration.usrs), "hints": [describe(result.annotation)], - "location": outputPath(result.declaration.location).string + "location": locationDescription(result.declaration.location) ] jsonObject.append(object) @@ -38,7 +38,7 @@ final class JsonFormatter: OutputFormatter { "accessibility": "", "ids": [ref.usr], "hints": [redundantConformanceHint], - "location": outputPath(ref.location).string + "location": locationDescription(ref.location) ] jsonObject.append(object) } diff --git a/Sources/PeripheryKit/Formatters/OutputFormatter.swift b/Sources/PeripheryKit/Formatters/OutputFormatter.swift index d29f28f2d..c801972a9 100644 --- a/Sources/PeripheryKit/Formatters/OutputFormatter.swift +++ b/Sources/PeripheryKit/Formatters/OutputFormatter.swift @@ -68,6 +68,15 @@ extension OutputFormatter { return path } + + func locationDescription(_ location: SourceLocation) -> String { + [ + outputPath(location).string, + String(location.line), + String(location.column) + ] + .joined(separator: ":") + } } public extension OutputFormat {