Skip to content

Commit ff6305f

Browse files
Merge pull request #244 from sapcc/support-disabling-reuse-overrides
2 parents aa879f8 + 4f47286 commit ff6305f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The config file has the following sections:
5555
* [golangciLint](#golangcilint)
5656
* [goReleaser](#goreleaser)
5757
* [makefile](#makefile)
58+
* [reuse](#reuse)
5859
* [metadata](#metadata)
5960
* [renovate](#renovate)
6061
* [spellCheck](#spellcheck)
@@ -235,6 +236,18 @@ makefile:
235236
`enabled` is an optional setting to disable the `Makefile` generation completely.
236237
If not specified, the setting is treated as being set to true to maintain backwards compatibility with older configs.
237238

239+
### `reuse`
240+
241+
```yaml
242+
reuse:
243+
enabled: false
244+
```
245+
246+
`reuse` contains settings related to the [REUSE](https://reuse.software/) config generation.
247+
248+
`enabled` is an optional setting to disable the REUSE config generation completely.
249+
If not specified, the setting is treated as being set to true to maintain backwards compatibility with older configs.
250+
238251
### `metadata`
239252

240253
```yaml

internal/core/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type Configuration struct {
3939
Renovate RenovateConfig `yaml:"renovate"`
4040
SpellCheck SpellCheckConfiguration `yaml:"spellCheck"`
4141
Test TestConfiguration `yaml:"testPackages"`
42+
Reuse ReuseConfiguration `yaml:"reuse"`
4243
Verbatim string `yaml:"verbatim"`
4344
VariableValues map[string]string `yaml:"variables"`
4445
}
@@ -69,6 +70,11 @@ type TestConfiguration struct {
6970
Except string `yaml:"except"`
7071
}
7172

73+
// ReuseConfiguration appears in type Configuration.
74+
type ReuseConfiguration struct {
75+
Enabled *bool `yaml:"enabled"`
76+
}
77+
7278
// CoverageConfiguration appears in type Configuration.
7379
type CoverageConfiguration struct {
7480
Only string `yaml:"only"`

internal/makefile/makefile.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,13 @@ endif
427427
})
428428

429429
if isGolang {
430-
reuseConfigFile := "REUSE.toml"
431-
must.Succeed(os.WriteFile(reuseConfigFile, reuseConfig, 0o666))
430+
// If disabled, the REUSE.toml file should not be overridden.
431+
// This is useful if the project needs additional information in
432+
// the REUSE.toml file, e.g., specific disclaimers.
433+
if cfg.Reuse.Enabled == nil || *cfg.Reuse.Enabled {
434+
reuseConfigFile := "REUSE.toml"
435+
must.Succeed(os.WriteFile(reuseConfigFile, reuseConfig, 0o666))
436+
}
432437

433438
licenseRulesFile := ".license-scan-rules.json"
434439
must.Succeed(os.WriteFile(licenseRulesFile, licenseRules, 0o666))

0 commit comments

Comments
 (0)