Properly detect multiple licenses and validate them.

This commit is contained in:
Marenz
2021-09-16 11:18:26 +02:00
parent 0fa24c786b
commit c81814915c
12 changed files with 68 additions and 46 deletions
@@ -0,0 +1,3 @@
// SPDX-License-Identifier: GPL-3.0 AND GPL-2.0
contract C {}
// ----
@@ -0,0 +1,3 @@
// SPDX-License-Identifier: GPL-3.0 OR GPL-2.0
contract C {}
// ----
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
// SPDX-License-Identifier: MIT
contract C {}
// ----
// ParserError 3716: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
// SPDX-License-Identifier: GPL-3.0
contract C {}
// ----
// ParserError 3716: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.
@@ -0,0 +1,5 @@
/* SPDX-License-Identifier: GPL-3.0 OR GPL-2.0
SPDX-License-Identifier: GPL-3.0 OR GPL-2.0 */
contract C {}
// ----
// ParserError 3716: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.
@@ -0,0 +1,4 @@
/* SPDX-License-Identifier: GPL-3.0 OR GPL-2.0 */ /* SPDX-License-Identifier: GPL-3.0 OR GPL-2.0 */
contract C {}
// ----
// ParserError 3716: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.
@@ -1,4 +1,4 @@
// This is parsed as GPL-3.0:
// SPDX-License-Identifier: GPL-3.0 ⡉⡊⡋⡌⡍⡎⡏⡐⡑⡒
contract C {}
// ----
// ParserError 1114: Invalid SPDX license identifier.
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: ⡉⡊⡋⡌⡍⡎⡏⡐⡑⡒
contract C {}
// ----
// Warning 1878: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
// ParserError 1114: Invalid SPDX license identifier.