reuse-tool does not properly handle the whitespace control modifiers in the Jinja2 comment lines
According to Whitespace Control — Template Designer Documentation — Jinja Documentation comments and other Jinja2 constructs can contain modifiers to control their whitespace control behavior, making the following markups possible:
{#- comment #}{# comment -#}{#+ comment #}{# comment +#}
Unfortunately, currently, the reuse-tool doesn't properly handle these modifiers and may consider the -/+ signs as part of the license declaration content.
Sample input file
{# Copyright 2023 林博仁(Buo-ren, Lin) <[email protected]> -#}
{# SPDX-License-Identifier: CC-BY-SA-4.0 -#}
Expected behavior
The CC-BY-SA-4.0 license declaration is properly detected.
Current behavior
The reuse lint command returns the following output:
$ reuse lint
# BAD LICENSES
'CC-BY-SA-4.0+ -' found in:
* test.j2
# MISSING LICENSES
'CC-BY-SA-4.0+ -' found in:
* test.j2
# SUMMARY
* Bad licenses: CC-BY-SA-4.0+ -
* Deprecated licenses: 0
* Licenses without file extension: 0
* Missing licenses: CC-BY-SA-4.0+ -
* Unused licenses: 0
* Used licenses: CC-BY-SA-4.0+ -
* Read errors: 0
* files with copyright information: 1 / 1
* files with license information: 1 / 1
Unfortunately, your project is not compliant with version 3.0 of the REUSE Specification :-(
It appears that the whitespace control modifier is treated literally as part of the license declaration.
Additional information
This issue is reproduced in reuse-tool 2.1.0.
A sample reproducible PoC is made: https://gitlab.com/brlin/reuse-tool-issue-884-bug-poc
Thanks for the report! This is a problem indeed.