Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ESLint and typescript-eslint-parser #499

Merged
merged 10 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove wildcard import
muno92 committed Nov 27, 2024
commit c882b151983a3c80bc29c935e5dfd38c30070b77
8 changes: 4 additions & 4 deletions src/report/sarif.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import * as fs from 'fs'
import {error} from '@actions/core'
import {readFileSync} from 'fs'
import {GitHubSeverity, Issue} from '../issue'
import {Report} from './report'

@@ -38,10 +38,10 @@ export class SarifReport extends Report {

let file: string
try {
file = fs.readFileSync(reportPath, {encoding: 'utf8'})
file = readFileSync(reportPath, {encoding: 'utf8'})
} catch (err) {
if (err instanceof Error) {
core.error(err.message)
error(err.message)
}
return
}
19 changes: 8 additions & 11 deletions src/report/xml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from '@actions/core'
import * as fs from 'fs'
import * as htmlparser2 from 'htmlparser2'
import {error} from '@actions/core'
import {readFileSync} from 'fs'
import {DomUtils, parseDocument} from 'htmlparser2'
import {Document, Element} from 'domhandler'
import {GitHubSeverity, Issue} from '../issue'
import {Report} from './report'
@@ -15,17 +15,17 @@ export class XmlReport extends Report {

let file: string
try {
file = fs.readFileSync(reportPath, {encoding: 'utf8'})
file = readFileSync(reportPath, {encoding: 'utf8'})
} catch (err) {
if (err instanceof Error) {
core.error(err.message)
error(err.message)
}
return
}

const ignoreIssueTypes = ignoreIssueType.split(',').map(s => s.trim())

const xml = htmlparser2.parseDocument(file)
const xml = parseDocument(file)
const issueTypes = this.extractIssueTypes(xml)
this.issues = this.extractIssues(xml, issueTypes, ignoreIssueTypes)
}
@@ -35,7 +35,7 @@ export class XmlReport extends Report {
issueTypes: IssueTypes,
ignoreIssueTypes: string[]
): Issue[] {
return htmlparser2.DomUtils.getElementsByTagName('issue', xml)
return DomUtils.getElementsByTagName('issue', xml)
.map(i => this.parseIssue(i, issueTypes))
.filter(
(issue): issue is NonNullable<Issue> =>
@@ -94,10 +94,7 @@ export class XmlReport extends Report {
}
}

const issueTypeTags = htmlparser2.DomUtils.getElementsByTagName(
'issuetype',
xml
)
const issueTypeTags = DomUtils.getElementsByTagName('issuetype', xml)
for (const issueType of issueTypeTags) {
const id = issueType.attributes.find(a => a.name.toLowerCase() === 'id')
if (!id) {