Skip to content

Commit 4d6119a

Browse files
feat: Drop support for net6,net7
Incorporate changes from SeWieland
1 parent 8f42b20 commit 4d6119a

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CodeQualityToGitlab/CodeQualityToGitlab.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackAsTool>true</PackAsTool>
99
<ToolCommandName>cq</ToolCommandName>
1010
<PackageOutputPath>./nupkg</PackageOutputPath>
11-
<Version>1.0.0</Version>
11+
<Version>2.0.0</Version>
1212
<Company>codecentric</Company>
1313
<Copyright>(c) codecentric</Copyright>
1414
<PackageProjectUrl>https://github.com/codecentric/dotnet_gitlab_code_quality</PackageProjectUrl>

CodeQualityToGitlab/SarifConverters/Converter1.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,19 @@ private static string GetPath(string? pathRoot, LocationVersionOne begin)
8181

8282
if (string.IsNullOrWhiteSpace(pathRoot))
8383
{
84-
return begin.ResultFile.Uri.LocalPath.Replace("//", "\\");
84+
return NormalizeSeparators(begin.ResultFile.Uri.LocalPath.Replace(@"\\", @"\"));
8585
}
86+
8687
var uri = new Uri(pathRoot);
87-
return uri.MakeRelativeUri(begin.ResultFile.Uri).ToString().Replace("//", "\\");
88+
var absolutePath = begin.ResultFile.Uri.LocalPath;
89+
var rootPath = uri.LocalPath;
90+
91+
if (absolutePath.StartsWith(rootPath))
92+
{
93+
return NormalizeSeparators(absolutePath[rootPath.Length..]);
94+
}
95+
96+
return NormalizeSeparators(begin.ResultFile.Uri.MakeRelativeUri(uri).ToString());
8897
}
8998

9099
private static Severity GetSeverity(ResultLevelVersionOne resultLevel)
@@ -100,4 +109,9 @@ private static Severity GetSeverity(ResultLevelVersionOne resultLevel)
100109
_ => throw new ArgumentOutOfRangeException(nameof(resultLevel), resultLevel, null)
101110
};
102111
}
112+
113+
private static string NormalizeSeparators(string source)
114+
{
115+
return source.Replace(@"\\", @"\").Replace("//", @"\");
116+
}
103117
}

Test/Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

0 commit comments

Comments
 (0)