Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getSuppressions = async (specPath: string): Promise => {
// find readme.md
try {
const readMe = await amd.findReadMe(path.dirname(specPath))
if (readMe === undefined) {
return undefined
}
const readMeStr = await vfs.readFile(readMe)
const cmd = md.parse(readMeStr)
const suppressionCodeBlock = amd.getCodeBlocksAndHeadings(cmd.markDown).Suppression
if (suppressionCodeBlock === undefined) {
return undefined
}
const suppression = amd.getYamlFromNode(suppressionCodeBlock) as amd.Suppression
if (!it.isArray(suppression.directive)) {
return undefined
}
return suppression
} catch (err) {
log.warn(`Unable to load and parse suppression file. Error: ${err}`)
export const getSuppressions = async (specPath: string): Promise => {
// find readme.md
try {
const readMe = await amd.findReadMe(path.dirname(specPath))
if (readMe === undefined) {
return undefined
}
const readMeStr = await vfs.readFile(readMe)
const cmd = md.parse(readMeStr)
const suppressionCodeBlock = amd.getCodeBlocksAndHeadings(cmd.markDown).Suppression
if (suppressionCodeBlock === undefined) {
return undefined
}
const suppression = amd.getYamlFromNode(suppressionCodeBlock) as amd.Suppression
if (!it.isArray(suppression.directive)) {
return undefined
}
return suppression
} catch (err) {
log.warn(`Unable to load and parse suppression file. Error: ${err}`)
return undefined
}
}
export const getSuppressions = async (specPath: string): Promise => {
// find readme.md
try {
const readMe = await amd.findReadMe(path.dirname(specPath))
if (readMe === undefined) {
return undefined
}
const readMeStr = await vfs.readFile(readMe)
const cmd = md.parse(readMeStr)
const suppressionCodeBlock = amd.getCodeBlocksAndHeadings(cmd.markDown).Suppression
if (suppressionCodeBlock === undefined) {
return undefined
}
const suppression = amd.getYamlFromNode(suppressionCodeBlock) as amd.Suppression
if (!it.isArray(suppression.directive)) {
return undefined
}
return suppression
} catch (err) {
log.warn(`Unable to load and parse suppression file. Error: ${err}`)
return undefined
}
}