Skip to content

Commit 940316d

Browse files
committed
lint
1 parent 407f9e8 commit 940316d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/main.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ let sarifResults: Object
1515
let cweXml: Document
1616

1717
let cweFilePath = resolve(dirname(process.argv[1]), '..//security-standards/owasp-top10-2021.xml')
18-
let cweFileXmlNs = {cwe: 'http://cwe.mitre.org/cwe-6'}
18+
const cweFileXmlNs = {cwe: 'http://cwe.mitre.org/cwe-6'}
1919
let cweIdXpath = '/cwe:Weakness_Catalog/cwe:Weaknesses/cwe:Weakness/@ID'
2020
let categoryXpath = '/cwe:Weakness_Catalog/cwe:Categories/cwe:Category[contains(@Name, "OWASP Top Ten 2021")]'
21-
let categoryMembersXpath = 'cwe:Relationships/cwe:Has_Member/@CWE_ID'
22-
let categoryNameAttr = '@Name'
23-
let categoryNameReplaceSearch = 'OWASP Top Ten 2021 Category '
24-
let codeQlCweTagPrefix = 'external/cwe/cwe-'
21+
const categoryMembersXpath = 'cwe:Relationships/cwe:Has_Member/@CWE_ID'
22+
const categoryNameAttr = '@Name'
23+
const categoryNameReplaceSearch = 'OWASP Top Ten 2021 Category '
24+
const codeQlCweTagPrefix = 'external/cwe/cwe-'
2525
let securityStandardTag = 'owasp-top10-2021'
26-
let codeQlTagsJsonPath = '$.runs[*].tool.extensions[*].rules[*].properties.tags'
26+
const codeQlTagsJsonPath = '$.runs[*].tool.extensions[*].rules[*].properties.tags'
2727

2828
// Parse Actions or CLI inputs
2929
if (env.GITHUB_ACTIONS === 'true') {
@@ -74,11 +74,11 @@ try {
7474
}
7575
const select = xpath.useNamespaces(cweFileXmlNs)
7676
const cweIds = (select(cweIdXpath, cweXml) as Attr[]).map(attribute => attribute.value)
77-
const cweCategoryNodes = (select(categoryXpath, cweXml) as Node[])
78-
let cweCategories: {[k: string]: string[]} = {}
77+
const cweCategoryNodes = select(categoryXpath, cweXml) as Node[]
78+
const cweCategories: {[k: string]: string[]} = {}
7979
for (const cweCategoryNode of cweCategoryNodes) {
80-
let memberCweIds = (select(categoryMembersXpath, cweCategoryNode) as Attr[]).map(attr => attr.value)
81-
let categoryName = (select(categoryNameAttr, cweCategoryNode, true) as Attr).value.replace(categoryNameReplaceSearch, '')
80+
const memberCweIds = (select(categoryMembersXpath, cweCategoryNode) as Attr[]).map(attr => attr.value)
81+
const categoryName = (select(categoryNameAttr, cweCategoryNode, true) as Attr).value.replace(categoryNameReplaceSearch, '')
8282
for (const cweId of memberCweIds) {
8383
cweCategories[cweId] = [...(cweCategories[cweId] || []), categoryName]
8484
}

0 commit comments

Comments
 (0)