in plugin-dotnet-agent/src/main/kotlin/jetbrains/buildServer/inspect/InspectCodeDataProcessor.kt [17:57]
override fun processData(context: DataProcessorContext) {
_reporter.markBuildAsInspectionsBuild()
_fileSystem.read(context.file) {
val inspectionTypeSeverities = mutableMapOf<String, InspectionSeverityValues>()
for (e in _xmlReader.read(it)) {
when (e.name.lowercase()) {
"issuetype" -> {
val severity = when (e["Severity"]?.lowercase()) {
"error" -> InspectionSeverityValues.ERROR
"warning" -> InspectionSeverityValues.WARNING
else -> InspectionSeverityValues.INFO
}
val type = InspectionTypeInfo()
type.id = e["Id"]
type.name = e["Description"]
type.category = e["Category"]
type.description = e["WikiUrl"] ?: "" //optional
if (type.id.isNotBlank()) {
inspectionTypeSeverities[type.id] = severity
_reporter.reportInspectionType(type)
}
}
"issue" -> {
val info = InspectionInstance()
info.inspectionId = e["TypeId"]
info.filePath = e["File"]?.replace("\\", "/")
info.line = e["Line"]?.toIntOrNull() ?: 0
info.message = e["Message"]
if (info.inspectionId.isNotBlank()) {
inspectionTypeSeverities[info.inspectionId]?.let { severity ->
info.addAttribute(InspectionAttributesId.SEVERITY.toString(), listOf(severity.toString()))
_reporter.reportInspection(info)
}
}
}
}
}
}
}