@@ -100,29 +100,31 @@ function notListedLicenses(parsedExpression) {
100100}
101101
102102/**
103- * Checks if a license expression string contains any not listed references.
103+ * Checks if a valid license expression string contains any not listed references.
104104 *
105- * @param {string } licenseToCheck - The license expression to check
106- * @returns {Array<string> } True if the license expression contains any document references, false otherwise
105+ * @param {string } licenseToCheck - The valid license expression to check
106+ * @returns {Array<string> } all not listed licenses
107107 */
108- function allNotListedLicenses ( licenseToCheck ) {
108+ function allNotListedLicensesInValidExpression ( licenseToCheck ) {
109109 const parseResult = parse ( licenseToCheck )
110110 return notListedLicenses ( parseResult )
111111}
112112
113113/**
114- * check if the license_expression contains license identifiers or exceptions
114+ * Check if the license_expression contains license identifiers or exceptions
115115 * that are not listed in the SPDX license list or Aboutcode's "ScanCode LicenseDB"
116- *
116+ * When the license expression is not valid SPDX the check is skipped
117+ * (this is checked in 6.1.54)
117118 * @param {string } licenseToCheck - The license expression to check
118- * @returns {Array<string> } True if the license has not listed licenses, false otherwise
119+ * @returns {Array<string> } all not listed licenses
120+ * empty array when the SPDX expression in not a valid
119121 */
120122export function getNotListedLicenses ( licenseToCheck ) {
121123 // Validate ensures that no invalid SPDX licenses are present
122124 if ( ! licenseToCheck || ! validate ( licenseToCheck ) . valid ) {
123125 return [ ]
124126 } else {
125- return allNotListedLicenses ( licenseToCheck )
127+ return allNotListedLicensesInValidExpression ( licenseToCheck )
126128 }
127129}
128130
@@ -137,9 +139,9 @@ export function isLangEnglishOrUnspecified(language) {
137139}
138140
139141/**
140- * test whether exactly one item in document notes exists that has the title License. The category of this item MUST be legal_disclaimer.
142+ * Test whether exactly one item in document notes exists that has the title ' License' . The category of this item MUST be ' legal_disclaimer' .
141143 * @param {({} & { category?: string | undefined; title?: string | undefined; } & Record<string, unknown>)[] } notes
142- * @returns {boolean } True if the language is valid, false otherwise
144+ * @returns {boolean } True there is exactly one note with title License and category legal_disclaimer
143145 */
144146function containsOneLegalNote ( notes ) {
145147 return (
@@ -181,7 +183,7 @@ export function mandatoryTest_6_1_55(doc) {
181183 message :
182184 `The license_expression contains the following license identifiers that ` +
183185 `are nor listed in Aboutcode's or SPDX license list: ` +
184- `"${ notListedLicenses . join ( ) } ". ` +
186+ `"${ notListedLicenses . join ( ', ' ) } ". ` +
185187 `Therefore exactly one note with ` +
186188 `title "License" and category "legal_disclaimer" must exist` ,
187189 } )
0 commit comments