fsfe / reuse-tool

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

`reuse annotate` won't add headers having `*.commented.jinja2` template #1049

Open zaufi opened 2 months ago

zaufi commented 2 months ago

Trying to annotate an executable bash script w/o *.sh extension I've got an error message:

$ reuse annotate --template hash --license CC0-1.0 --copyright '…' --merge-copyrights --copyright-prefix spdx ./my-script
…
reuse annotate: error: The following files do not have a recognised file extension. Please use --style, --force-dot-license, --fallback-dot-license, or --skip-unrecognised:

my-script

However, having a template with proper comments reuse shouldn't even try to detect comments style for the given file (IMHO):

$ ll .reuse/templates/
.rw-r--r-- 286 exher exher 14 Jul 02:30 hash.commented.jinja2
.rw-r--r-- 119 exher exher 11 Jul 03:59 hash.commented.jinja2.license
carmenbianca commented 1 month ago

I don't think this should be closed. This seems like a bug to me!

zaufi commented 1 month ago

I don't think this should be closed. This seems like a bug to me!

Working w/ REUSE a bit more I've realized (didn't dig into sources, just my guess) that from the commented template it's not possible to get a comment style for a file. Meanwhile, REUSE should parse the given file to "understand" the copyright header which is normally a comment...