fsfe / reuse-tool

reuse is a tool for compliance with the REUSE recommendations.
https://reuse.software
368 stars 139 forks source link

Tool fails to parse file when there's no newline after the license name #990

Open hyperglitch opened 1 month ago

hyperglitch commented 1 month ago

reuse tool fails to parse the SPDX text if there's no newline character after the license name. Good example are the KiCad files (schematic, PCB, part libraries) which have fields for custom metadata (such as licence) which are then visible in the documentbut in the resulting file the SPDX text becomes a part of the s-expression. For example:

(comment 1 "SPDX-FileCopyrightText: 2024 Igor Brkic <igor@hyperglitch.com>")
(comment 2 "SPDX-License-Identifier: CERN-OHL-S-2.0")

Running the reuse tool results in:

reuse._util - ERROR - Could not parse 'CERN-OHL-S-2.0")'
reuse.project - ERROR - '../hw/JellyfishOPP.kicad_sch' holds an SPDX expression that cannot be parsed, skipping the file

Here's the example file: https://gitlab.com/hyperglitch/jellyfish/-/blob/main/hw/JellyfishOPP.kicad_sch?ref_type=heads