Created
March 15, 2016 09:38
-
-
Save fguchelaar/92f25f3931fdf0e44dd1 to your computer and use it in GitHub Desktop.
Running JetBrains' InspectCode outputs an XML-file with references to the inspected files which are relative to the solution that was provided to the cli. When this XML-file is used with Jenkins' Warnings-plugin, the links to files (in the inspection-report) cannot be resolved, if the solution is not in the root of the workspace. This script pre…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$file = $(throw "-file is required."), | |
[string]$path = $(throw "-path is required.") | |
) | |
[System.IO.FileInfo]$fileInfo = $file | |
[xml]$xml = Get-Content -Path $file | |
foreach ($project in $xml.Report.Issues.Project) { | |
$projectName = $project.Name | |
write-output "Fixing @File attributes for project '$projectName'" | |
foreach ($issue in $project.Issue) { | |
$issue.File = $path + $issue.File | |
} | |
} | |
$xml.Save($file + ".fixed.xml") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running JetBrains' InspectCode outputs an XML-file with references to the inspected files which are relative to the solution that was provided to the cli. When this XML-file is used with Jenkins' Warnings-plugin, the links to files (in the inspection-report) cannot be resolved, if the solution is not in the root of the workspace. This script prefixes all
@File
attributes with a provided argument.Usage in Jenkins:
InspectCodeFixPath.ps1 -file "$env:WORKSPACE/InspectCode.xml" -path "Compile/project/"