Skip to content

Commit 2cb1d85

Browse files
committed
Fix tests
1 parent 470e913 commit 2cb1d85

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

src/status-report.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ const testCreateInitWithConfigStatusReport = test.macro({
316316
const initStatusReport: InitStatusReport = {
317317
...statusReportBase,
318318
tools_input: "",
319+
computed_tools_input: "",
319320
tools_resolved_version: "foo",
320321
tools_source: ToolsSource.Unknown,
321322
workflow_languages: "actions",

src/upload-lib.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,7 @@ const GENERIC_404_MSG =
4747
// Checks whether the deprecation warning for combining SARIF files should be shown.
4848
export async function shouldShowCombineSarifFilesDeprecationWarning(
4949
sarifObjects: Array<Partial<sarif.Log>>,
50-
githubVersion: GitHubVersion,
5150
) {
52-
// Do not show this warning on GHES versions before 3.14.0
53-
if (
54-
githubVersion.type === GitHubVariant.GHES &&
55-
satisfiesGHESVersion(githubVersion.version, "<3.14", true)
56-
) {
57-
return false;
58-
}
59-
6051
// Only give a deprecation warning when not all runs are unique and
6152
// we haven't already shown the warning.
6253
return (
@@ -131,12 +122,7 @@ async function combineSarifFilesUsingCLI(
131122
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
132123
);
133124

134-
if (
135-
await shouldShowCombineSarifFilesDeprecationWarning(
136-
sarifObjects,
137-
gitHubVersion,
138-
)
139-
) {
125+
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
140126
logger.warning(
141127
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`,
142128
);
@@ -1053,7 +1039,7 @@ function sanitize(str?: string) {
10531039
return (str ?? "_").replace(/[^a-zA-Z0-9_]/g, "_").toLocaleUpperCase();
10541040
}
10551041

1056-
function filterAlertsByDiffRange(
1042+
export function filterAlertsByDiffRange(
10571043
logger: Logger,
10581044
sarifLog: Partial<sarif.Log>,
10591045
): Partial<sarif.Log> {
@@ -1066,8 +1052,6 @@ function filterAlertsByDiffRange(
10661052
return sarifLog;
10671053
}
10681054

1069-
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
1070-
10711055
for (const run of sarifLog.runs) {
10721056
if (run.results) {
10731057
run.results = run.results.filter((result) => {
@@ -1082,19 +1066,14 @@ function filterAlertsByDiffRange(
10821066
if (!locationUri || locationStartLine === undefined) {
10831067
return false;
10841068
}
1085-
// CodeQL always uses forward slashes as the path separator, so on Windows we
1086-
// need to replace any backslashes with forward slashes.
1087-
const locationPath = path
1088-
.join(checkoutPath, locationUri)
1089-
.replaceAll(path.sep, "/");
10901069
// Alert filtering here replicates the same behavior as the restrictAlertsTo
10911070
// extensible predicate in CodeQL. See the restrictAlertsTo documentation
10921071
// https://codeql.github.com/codeql-standard-libraries/csharp/codeql/util/AlertFiltering.qll/predicate.AlertFiltering$restrictAlertsTo.3.html
10931072
// for more details, such as why the filtering applies only to the first line
10941073
// of an alert location.
10951074
return diffRanges.some(
10961075
(range) =>
1097-
range.path === locationPath &&
1076+
range.path === locationUri &&
10981077
((range.startLine <= locationStartLine &&
10991078
range.endLine >= locationStartLine) ||
11001079
(range.startLine === 0 && range.endLine === 0)),

0 commit comments

Comments
 (0)