Prevent disabling all checks
Prevent users from disabling both the license and vulnerability check by checking if both are set to `false` and throwing if that's the case.
This commit is contained in:
@@ -215,6 +215,14 @@ test('it parses the vulnerability-check input', async () => {
|
|||||||
expect(options.vulnerability_check).toEqual(true)
|
expect(options.vulnerability_check).toEqual(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('it is not impossible to disable both checks', async () => {
|
||||||
|
setInput('license-check', 'false')
|
||||||
|
setInput('vulnerability-check', 'false')
|
||||||
|
expect(() => {
|
||||||
|
readConfig()
|
||||||
|
}).toThrow("Can't disable both license-check and vulnerability-check")
|
||||||
|
})
|
||||||
|
|
||||||
describe('licenses that are not valid SPDX licenses', () => {
|
describe('licenses that are not valid SPDX licenses', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
jest.spyOn(Utils, 'isSPDXValid').mockReturnValue(false)
|
jest.spyOn(Utils, 'isSPDXValid').mockReturnValue(false)
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ export function readInlineConfig(): ConfigurationOptions {
|
|||||||
.boolean()
|
.boolean()
|
||||||
.default(true)
|
.default(true)
|
||||||
.parse(getOptionalBoolean('vulnerability-check'))
|
.parse(getOptionalBoolean('vulnerability-check'))
|
||||||
|
if (license_check === false && vulnerability_check === false) {
|
||||||
|
throw new Error("Can't disable both license-check and vulnerability-check")
|
||||||
|
}
|
||||||
|
|
||||||
const base_ref = getOptionalInput('base-ref')
|
const base_ref = getOptionalInput('base-ref')
|
||||||
const head_ref = getOptionalInput('head-ref')
|
const head_ref = getOptionalInput('head-ref')
|
||||||
|
|||||||
Reference in New Issue
Block a user