Use Array.isArray
This commit is contained in:
parent
1e7a38893c
commit
57eca7cbb2
3 changed files with 9 additions and 9 deletions
8
lib/util.js
generated
8
lib/util.js
generated
|
|
@ -676,7 +676,7 @@ function fixInvalidNotifications(sarif, logger) {
|
||||||
`${shared_environment_1.CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX} environment variable.`);
|
`${shared_environment_1.CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX} environment variable.`);
|
||||||
return sarif;
|
return sarif;
|
||||||
}
|
}
|
||||||
if (!(sarif.runs instanceof Array)) {
|
if (!Array.isArray(sarif.runs)) {
|
||||||
return sarif;
|
return sarif;
|
||||||
}
|
}
|
||||||
// Ensure that the array of locations for each SARIF notification contains unique locations.
|
// Ensure that the array of locations for each SARIF notification contains unique locations.
|
||||||
|
|
@ -687,19 +687,19 @@ function fixInvalidNotifications(sarif, logger) {
|
||||||
...sarif,
|
...sarif,
|
||||||
runs: sarif.runs.map((run) => {
|
runs: sarif.runs.map((run) => {
|
||||||
if (run.tool?.driver?.name !== "CodeQL" ||
|
if (run.tool?.driver?.name !== "CodeQL" ||
|
||||||
!(run.invocations instanceof Array)) {
|
!Array.isArray(run.invocations)) {
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...run,
|
...run,
|
||||||
invocations: run.invocations.map((invocation) => {
|
invocations: run.invocations.map((invocation) => {
|
||||||
if (!(invocation.toolExecutionNotifications instanceof Array)) {
|
if (!Array.isArray(invocation.toolExecutionNotifications)) {
|
||||||
return invocation;
|
return invocation;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...invocation,
|
...invocation,
|
||||||
toolExecutionNotifications: invocation.toolExecutionNotifications.map((notification) => {
|
toolExecutionNotifications: invocation.toolExecutionNotifications.map((notification) => {
|
||||||
if (!(notification.locations instanceof Array)) {
|
if (!Array.isArray(notification.locations)) {
|
||||||
return notification;
|
return notification;
|
||||||
}
|
}
|
||||||
const newLocations = removeDuplicateLocations(notification.locations);
|
const newLocations = removeDuplicateLocations(notification.locations);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -823,7 +823,7 @@ export function fixInvalidNotifications(
|
||||||
);
|
);
|
||||||
return sarif;
|
return sarif;
|
||||||
}
|
}
|
||||||
if (!(sarif.runs instanceof Array)) {
|
if (!Array.isArray(sarif.runs)) {
|
||||||
return sarif;
|
return sarif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -837,21 +837,21 @@ export function fixInvalidNotifications(
|
||||||
runs: sarif.runs.map((run) => {
|
runs: sarif.runs.map((run) => {
|
||||||
if (
|
if (
|
||||||
run.tool?.driver?.name !== "CodeQL" ||
|
run.tool?.driver?.name !== "CodeQL" ||
|
||||||
!(run.invocations instanceof Array)
|
!Array.isArray(run.invocations)
|
||||||
) {
|
) {
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...run,
|
...run,
|
||||||
invocations: run.invocations.map((invocation) => {
|
invocations: run.invocations.map((invocation) => {
|
||||||
if (!(invocation.toolExecutionNotifications instanceof Array)) {
|
if (!Array.isArray(invocation.toolExecutionNotifications)) {
|
||||||
return invocation;
|
return invocation;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...invocation,
|
...invocation,
|
||||||
toolExecutionNotifications:
|
toolExecutionNotifications:
|
||||||
invocation.toolExecutionNotifications.map((notification) => {
|
invocation.toolExecutionNotifications.map((notification) => {
|
||||||
if (!(notification.locations instanceof Array)) {
|
if (!Array.isArray(notification.locations)) {
|
||||||
return notification;
|
return notification;
|
||||||
}
|
}
|
||||||
const newLocations = removeDuplicateLocations(
|
const newLocations = removeDuplicateLocations(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue