reuse-tool
reuse-tool copied to clipboard
`--style` setting works incorrectly with `UncommentableCommentStyle`
I have some SVG files where I want to use HTML style comments rather than license files.
Passing --style html just seems to put HTML-style comments in the license file.
This both doesn't make sense and doesn't allow any way to use a HTML-style header comment.
A simple solution would be to change SVG to HtmlCommentStyle but that's apparently undesirable for machine-generated SVG files, so a slightly more complex solution is needed.
You'd want to avoid accidentally adding a license header to a JPEG though, which could happen if the tool honored the --style parameter regardless if the file is an actual binary file, or just a file where a comment header is normally not desired. So the tool needs to be able to distinguish between these cases.
Phew, in order to make that work we'd need
- A list of files/extensions that defines these optional syntaxes that can, but usually are not edited directly
- A flag like
--force-headerthat applies this.
Are there other file types like SVG that would fall in this category?
Typically "does it contain 0 bytes" is a fairly reasonable indicator if something is a binary file or not. I could imagine that if you apply an explicit --style argument, it would actually do that, unless the file is a binary file.
Hm, but then it would also be possible to enforce comments e.g. in JSON files which would break their syntax. I am afraid that this could lead to unwanted results when running addheader in bulk operations.
Some dialects of JSON do actually support JS-style comments, so it's not that weird in my mind.
I'd argue that doing bulk operations with --style with files that are not compatible with that style is always going to produce wrong results.
If someone wants JS-style comments in their JSON, they should be able to do that.