Skeleton for license validation.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import {Change, ChangeSchema} from './schemas'
|
||||
|
||||
export function hasInvalidLicenses(
|
||||
changes: Array<Change>,
|
||||
allowLicenses: Array<string> | undefined,
|
||||
failLicenses: Array<string> | undefined
|
||||
): Array<Change> {
|
||||
let disallowed: Change[] = []
|
||||
|
||||
if (allowLicenses === undefined) {
|
||||
allowLicenses = []
|
||||
}
|
||||
if (failLicenses === undefined) {
|
||||
failLicenses = []
|
||||
}
|
||||
|
||||
for (const change of changes) {
|
||||
let license = change.license
|
||||
// TODO: be loud about unknown licenses
|
||||
if (license === null) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (allowLicenses.includes(license)) {
|
||||
disallowed.push(change)
|
||||
}
|
||||
}
|
||||
|
||||
return disallowed
|
||||
}
|
||||
|
||||
export function printLicensesError(changes: Array<Change>): void {
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user