google / addlicense

A program which ensures source code files have copyright license headers by scanning directory patterns recursively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copyright line should append after the SPDX identifier

Dentrax opened this issue · comments

I just tried SPDX flag first time and noticed addlicense adds copyright line before the SPDX identifier.

$ addlicense -s=only -c Furkan .

Actual:

Copyright ...
SPDX-License-Identifier:

My expectation according to other open source projects, solidity, etc.:

SPDX-License-Identifier:
Copyright ...

Any ways to reorder of those? Shouldn't the right way is the bottom one?

I don't think there is a "right way". I've always listed copyright first, since that is how non-SPDX license declarations nearly always appear. I've never paid much attention to how others do it. I think it should be trivial to reverse using a custom license template?

also regarding any "right way", unfortunately the SPDX docs only talk about the SPDX line itself, nothing about where it falls in relation to other information: https://spdx.dev/ids/

Though they do have a few additional links:

So, there does not seem to be consensus, but most seem to list copyright first. I wonder if linux has SPDX first because they added it to most files after the fact, and it's much easier to automate simply adding it as the first line of files. This looks to be the main commit where that happened.

Thanks for the prompt response and the references! I think passing a custom license template would better in this case, as you said.