-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script documentation: run addheader
on new files via pre-commit
#534
Comments
I am wondering if there is a possibility to reconsider this:
I'm finding this rivosinc#1 very useful on projects I convert to reuse compliance. After I go through the manual process of annotating the headers, I know the rule(s) of the project and I want to apply those in the future by setting them up in the |
@kbroch-rivosinc thanks for commenting and writing that pre-commit hook! The main concern with automated annotations is the risk of it being incorrect and eventually being published as the truth. Looking at the PR you linked, it seems that the user still needs to configure the pre-commit hook to add copyright and license properties. One could argue that this is similar to some wildcard matching based on a Still I think we should add plenty of warnings to communicate that there is no guarantee for correctness if applied automatically. Interested to hear what others think. |
Regarding the pre-commit hook, having a mechanism for defaults would be necessary, as discussed in #68 (comment) because that would allow users to set their own default annotations. This is a better practice than setting project-specific default annotations. So we consider annotation defaults as discussed in #68 a dependency for moving this forward. But we think then having a pre-commit hook with annotations can make sense. We agree that having this mechanism in place would be a great usability improvement. |
Hi, I just wanted to add that we would also like to use this kind of automation (ideally the pre-commit hook) in our ginkgo project (ginkgo-project/ginkgo#1460). Currently, we add a local hook for that. |
This is still on the todo list. With a little luck it will be worked on in the coming months. |
I'm using for a java project... just started using "reuse" because, spotless argh, anyways, shared the whole thing for what I have right now to allow people to have a more thorough understanding of combining it with other tools. # SPDX-FileCopyrightText: Copyright © 2024 Caleb Cushing
#
# SPDX-License-Identifier: CC0-1.0
# .lintstagedrc.yml
"*.java":
- "reuse annotate --license 'Apache-2.0' --copyright 'Caleb Cushing' --copyright-prefix spdx-string-symbol --merge-copyrights"
- &prettier "prettier --cache --ignore-unknown --write"
"*.gradle.kts":
- &mit "reuse annotate --license 'MIT' --copyright 'Caleb Cushing' --copyright-prefix spdx-string-symbol --merge-copyrights --skip-unrecognised"
- ktlint --format
"*.md":
- "reuse annotate --license 'CC-BY-NC-4.0' --copyright 'Caleb Cushing' --copyright-prefix spdx-string-symbol --merge-copyrights"
- *prettier
"*.xml":
- "reuse annotate --license 'CC0-1.0' --copyright 'Caleb Cushing' --copyright-prefix spdx-string-symbol --merge-copyrights"
- *prettier
"gradle-wrapper.jar":
- "reuse annotate --license 'Apache-2.0' --copyright 'Gradle, Inc' --copyright-prefix spdx-string-symbol --merge-copyrights --skip-unrecognised gradle/wrapper/gradle-wrapper.jar"
"!(*.java|*.gradle.kts|*.md|*.xml|*.jar|*.license)":
- *mit
- *prettier |
@carmenbianca desires a feature that somehow automatically takes care of adding REUSE headers to new files, ideally via a pre-commit hook. Ideally, this would also be configurable per repo, as mentioned in #68.
The tool maintainers agreed that this should not be included in the tool itself, because there are a number of difficulties:
Instead, we should document how developers could do this in the scripts documentation. while making the aware of the potential issues.
The text was updated successfully, but these errors were encountered: