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.`);
|
||||
return sarif;
|
||||
}
|
||||
if (!(sarif.runs instanceof Array)) {
|
||||
if (!Array.isArray(sarif.runs)) {
|
||||
return sarif;
|
||||
}
|
||||
// Ensure that the array of locations for each SARIF notification contains unique locations.
|
||||
|
|
@ -687,19 +687,19 @@ function fixInvalidNotifications(sarif, logger) {
|
|||
...sarif,
|
||||
runs: sarif.runs.map((run) => {
|
||||
if (run.tool?.driver?.name !== "CodeQL" ||
|
||||
!(run.invocations instanceof Array)) {
|
||||
!Array.isArray(run.invocations)) {
|
||||
return run;
|
||||
}
|
||||
return {
|
||||
...run,
|
||||
invocations: run.invocations.map((invocation) => {
|
||||
if (!(invocation.toolExecutionNotifications instanceof Array)) {
|
||||
if (!Array.isArray(invocation.toolExecutionNotifications)) {
|
||||
return invocation;
|
||||
}
|
||||
return {
|
||||
...invocation,
|
||||
toolExecutionNotifications: invocation.toolExecutionNotifications.map((notification) => {
|
||||
if (!(notification.locations instanceof Array)) {
|
||||
if (!Array.isArray(notification.locations)) {
|
||||
return notification;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (!(sarif.runs instanceof Array)) {
|
||||
if (!Array.isArray(sarif.runs)) {
|
||||
return sarif;
|
||||
}
|
||||
|
||||
|
|
@ -837,21 +837,21 @@ export function fixInvalidNotifications(
|
|||
runs: sarif.runs.map((run) => {
|
||||
if (
|
||||
run.tool?.driver?.name !== "CodeQL" ||
|
||||
!(run.invocations instanceof Array)
|
||||
!Array.isArray(run.invocations)
|
||||
) {
|
||||
return run;
|
||||
}
|
||||
return {
|
||||
...run,
|
||||
invocations: run.invocations.map((invocation) => {
|
||||
if (!(invocation.toolExecutionNotifications instanceof Array)) {
|
||||
if (!Array.isArray(invocation.toolExecutionNotifications)) {
|
||||
return invocation;
|
||||
}
|
||||
return {
|
||||
...invocation,
|
||||
toolExecutionNotifications:
|
||||
invocation.toolExecutionNotifications.map((notification) => {
|
||||
if (!(notification.locations instanceof Array)) {
|
||||
if (!Array.isArray(notification.locations)) {
|
||||
return notification;
|
||||
}
|
||||
const newLocations = removeDuplicateLocations(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue