google / addlicense

A program which ensures source code files have copyright license headers by scanning directory patterns recursively
Apache License 2.0
724 stars 169 forks source link

Copyright line should append after the SPDX identifier #131

Open Dentrax opened 1 year ago

Dentrax commented 1 year ago

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?

willnorris commented 1 year ago

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?

willnorris commented 1 year ago

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.

Dentrax commented 1 year ago

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