diff --git a/.github/actions/publish-spotbugs-reports/dist/index.js b/.github/actions/publish-spotbugs-reports/dist/index.js index f2fc17f1..71147533 100644 --- a/.github/actions/publish-spotbugs-reports/dist/index.js +++ b/.github/actions/publish-spotbugs-reports/dist/index.js @@ -35350,6 +35350,24 @@ const glob = __nccwpck_require__(3823) const { XMLParser } = __nccwpck_require__(8396) const { readFileSync } = __nccwpck_require__(7147) +function bugAnnotation(bug) { + if (Object.hasOwn(bug, 'Method') && !Array.isArray(bug.Method)) { + const title = bug['@_bad_practice'] + const message = bug.ShortMessage + const rawDetails = bug.LongMessage + return { + title: title, + message: message, + raw_details: rawDetails, + path: bug.Method.SourceLine['@_relSourcepath'], + start_line: Number(bug.Method.SourceLine['@_start']), + end_line: Number(bug.Method.SourceLine['@_end']), + annotation_level: 'warning', + } + } + return null +} + async function getAnnotations() { const parseOptions = { ignoreAttributes: false, @@ -35372,18 +35390,9 @@ async function getAnnotations() { ) for (const bugInstance of data.BugCollection.BugInstance) { - if ( - Object.hasOwn(bugInstance, 'Method') && - !Array.isArray(bugInstance.Method) - ) { - annotations.push({ - path: bugInstance.Method.SourceLine['@_sourcepath'], - start_line: Number(bugInstance.Method.SourceLine['@_start']), - end_line: Number(bugInstance.Method.SourceLine['@_end']), - annotation_level: 'warning', - title: bugInstance.ShortMessage, - message: bugInstance.LongMessage, - }) + const annotation = bugAnnotation(bugInstance) + if (annotation != null) { + annotations.push(annotation) } } } diff --git a/.github/actions/publish-spotbugs-reports/index.js b/.github/actions/publish-spotbugs-reports/index.js index 3bf9d6ec..94e63f92 100644 --- a/.github/actions/publish-spotbugs-reports/index.js +++ b/.github/actions/publish-spotbugs-reports/index.js @@ -4,6 +4,24 @@ const glob = require('@actions/glob') const { XMLParser } = require('fast-xml-parser') const { readFileSync } = require('fs') +function bugAnnotation(bug) { + if (Object.hasOwn(bug, 'Method') && !Array.isArray(bug.Method)) { + const title = bug['@_bad_practice'] + const message = bug.ShortMessage + const rawDetails = bug.LongMessage + return { + title: title, + message: message, + raw_details: rawDetails, + path: bug.Method.SourceLine['@_relSourcepath'], + start_line: Number(bug.Method.SourceLine['@_start']), + end_line: Number(bug.Method.SourceLine['@_end']), + annotation_level: 'warning', + } + } + return null +} + async function getAnnotations() { const parseOptions = { ignoreAttributes: false, @@ -26,18 +44,9 @@ async function getAnnotations() { ) for (const bugInstance of data.BugCollection.BugInstance) { - if ( - Object.hasOwn(bugInstance, 'Method') && - !Array.isArray(bugInstance.Method) - ) { - annotations.push({ - path: bugInstance.Method.SourceLine['@_sourcepath'], - start_line: Number(bugInstance.Method.SourceLine['@_start']), - end_line: Number(bugInstance.Method.SourceLine['@_end']), - annotation_level: 'warning', - title: bugInstance.ShortMessage, - message: bugInstance.LongMessage, - }) + const annotation = bugAnnotation(bugInstance) + if (annotation != null) { + annotations.push(annotation) } } }