Skip to content
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

reuse configuration file #1112

Open
xenoterracide opened this issue Nov 28, 2024 · 0 comments
Open

reuse configuration file #1112

xenoterracide opened this issue Nov 28, 2024 · 0 comments

Comments

@xenoterracide
Copy link

xenoterracide commented Nov 28, 2024

from what I've understood from the REUSE.toml is it's more for documenting files I don't want to add a license comment or a .license file? sorry if this is wrong

I'm looking for a way to reduce the amount of code for each statement here #534 (comment)

# 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

I feel like I would want to write this in 1 of two ways to reduce this code, these options are just things I could make defaults, they would be overriden on the cli. I think honestly either/or options/license-map would help my problem, both would allow me to just run reuse annotate

# .reuserc.toml
[options]
merge-copyrights=true
copyright-prefix="spdx-string-symbol"
copyright="Caleb Cushing"
[license-map]
"!(*.java|*.gradle.kts|*.md|*.xml|*.jar|*.license)" = "MIT"

with just options I could rewrite my yaml file to look like this

# SPDX-FileCopyrightText: Copyright © 2024 Caleb Cushing
#
# SPDX-License-Identifier: CC0-1.0

# .lintstagedrc.yml
"*.java":
  - "reuse annotate --license 'Apache-2.0'"
  - &prettier "prettier --cache --ignore-unknown --write"
"*.gradle.kts":
  - &mit "reuse annotate --license 'MIT'"
  - ktlint --format
"*.md":
  - "reuse annotate --license 'CC-BY-NC-4.0'"
  - *prettier
"*.xml":
  - "reuse annotate --license 'CC0-1.0'"
  - *prettier
"gradle-wrapper.jar":
  - "reuse annotate --license 'Apache-2.0' --copyright 'Gradle, Inc' gradle/wrapper/gradle-wrapper.jar"
"!(*.java|*.gradle.kts|*.md|*.xml|*.jar|*.license)":
  - *mit
  - *prettier

with just the license map

# SPDX-FileCopyrightText: Copyright © 2024 Caleb Cushing
#
# SPDX-License-Identifier: CC0-1.0

# .lintstagedrc.yml
"*.java":
  - "&reuse reuse annotate  --copyright 'Caleb Cushing' --copyright-prefix spdx-string-symbol --merge-copyrights"
  - &prettier "prettier --cache --ignore-unknown --write"
"*.gradle.kts":
  - *reuse
  - ktlint --format
"*.md":
  - *reuse
  - *prettier
"*.xml":
  - *reuse
  - *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)":
  - *reuse
  - *prettier

in any direction it reduces my copy pasta. In case I haven't said it, such a file should have zero legal bearing and should not be taken into consideration by tools like reuse lint (anymore than something like my lintstagedrc does)

@xenoterracide xenoterracide changed the title reuse mapping configuration file reuse configuration file Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant