Skip to content

Commit 5f61dd3

Browse files
committed
Restore final qualifiers and tidy whitespace in file scopes
- Mark file/enabled/overwrite/maxTasks final on the four nested file scopes and final on name/ending/defaultEnabled in BaseFileConfig (each is assigned exactly once in a constructor body) - Normalise whitespace: drop trailing spaces and double-space after `=` - Add CHANGELOG entry under New > Bug Fixes Signed-off-by: Jonathan Manning <jonathan.manning@seqera.io>
1 parent a0f56de commit 5f61dd3

6 files changed

Lines changed: 30 additions & 28 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# New
22
## Bug Fixes:
3+
- Eliminated `Unrecognized config option` warnings under Nextflow's v2 syntax parser by registering `CO2FootprintConfig` as an extension point and aligning the nested file-config scopes with the v2 `ConfigScope` discovery rules
34

45
## Misc:
56

src/main/nextflow/co2footprint/Config/BaseFileConfig.groovy

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ import java.nio.file.Path
1313
*/
1414
@Slf4j
1515
class BaseFileConfig {
16-
String name
17-
String ending
18-
boolean defaultEnabled
16+
final String name
17+
final String ending
18+
final boolean defaultEnabled
1919

2020
protected final LinkedHashSet<String> usedKeys = [] as LinkedHashSet<String>
21-
21+
22+
2223
/**
2324
* Parses a file-based sub-configuration for nf-co2footprint and sets up defaults and fallbacks.
2425
*
@@ -33,7 +34,7 @@ class BaseFileConfig {
3334

3435
/**
3536
* Define a file path from the given config map and timestamp, as well as predefined variables.
36-
*
37+
*
3738
* @param fileConfig The general config of this file.
3839
* @param timestamp A timestamp string.
3940
* @return The path to the file.

src/main/nextflow/co2footprint/Config/ProvenanceFileConfig.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class ProvenanceFileConfig extends BaseFileConfig implements ConfigScope {
1212

1313
@ConfigOption
1414
@Description('Path to the file.')
15-
Path file
15+
final Path file
1616

1717
@ConfigOption
1818
@Description('Whether to enable the file creation.')
19-
Boolean enabled
19+
final Boolean enabled
2020

2121
@ConfigOption
2222
@Description('Whether to overwrite a file if it already exists.')
23-
Boolean overwrite
23+
final Boolean overwrite
2424

2525
@ConfigOption
2626
@Description('Whether only emission metrics should be reported in the provenance file.')
@@ -30,7 +30,7 @@ class ProvenanceFileConfig extends BaseFileConfig implements ConfigScope {
3030
super('provenance', 'json', false)
3131

3232
file = defineFile(provenanceFileConfig, timestamp)
33-
enabled = defineEnabled(provenanceFileConfig)
33+
enabled = defineEnabled(provenanceFileConfig)
3434
overwrite = defineOverwrite(provenanceFileConfig)
3535

3636
emissionMetricsOnly = provenanceFileConfig.containsKey('emissionMetricsOnly') ?

src/main/nextflow/co2footprint/Config/ReportFileConfig.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ class ReportFileConfig extends BaseFileConfig implements ConfigScope {
1212

1313
@ConfigOption
1414
@Description('Path to the file.')
15-
Path file
15+
final Path file
1616

1717
@ConfigOption
1818
@Description('Whether to enable the file creation.')
19-
Boolean enabled
19+
final Boolean enabled
2020

2121
@ConfigOption
2222
@Description('Whether to overwrite a file if it already exists.')
23-
Boolean overwrite
23+
final Boolean overwrite
2424

2525
@ConfigOption
2626
@Description('The number of maximum tasks that is displayed in the report.')
27-
Integer maxTasks
27+
final Integer maxTasks
2828

2929
ReportFileConfig(Map reportFileConfig, String timestamp=null) {
3030
super('report', 'html')
3131

3232
file = defineFile(reportFileConfig, timestamp)
33-
enabled = defineEnabled(reportFileConfig)
33+
enabled = defineEnabled(reportFileConfig)
3434
overwrite = defineOverwrite(reportFileConfig)
35-
35+
3636
maxTasks = reportFileConfig.containsKey('maxTasks') ?
3737
CO2FootprintConfig.getCollect('maxTasks', reportFileConfig, usedKeys) as Integer :
3838
10_000

src/main/nextflow/co2footprint/Config/SummaryFileConfig.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ import nextflow.script.dsl.Description
88
import java.nio.file.Path
99

1010
@Description('The `co2footprint.summary` scope allows you to configure the summary file of the `nf-co2footprint` plugin.')
11-
class SummaryFileConfig extends BaseFileConfig implements ConfigScope{
11+
class SummaryFileConfig extends BaseFileConfig implements ConfigScope {
1212

1313
@ConfigOption
1414
@Description('Path to the file.')
15-
Path file
15+
final Path file
1616

1717
@ConfigOption
1818
@Description('Whether to enable the file creation.')
19-
Boolean enabled
19+
final Boolean enabled
2020

2121
@ConfigOption
2222
@Description('Whether to overwrite a file if it already exists.')
23-
Boolean overwrite
23+
final Boolean overwrite
2424

2525
SummaryFileConfig(Map summaryFileConfig, String timestamp=null) {
2626
super('summary', 'txt')
2727

2828
file = defineFile(summaryFileConfig, timestamp)
29-
enabled = defineEnabled(summaryFileConfig)
29+
enabled = defineEnabled(summaryFileConfig)
3030
overwrite = defineOverwrite(summaryFileConfig)
31-
31+
3232
CO2FootprintConfig.checkKeyUsage(summaryFileConfig, usedKeys)
3333
}
3434
}

src/main/nextflow/co2footprint/Config/TraceFileConfig.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ import nextflow.script.dsl.Description
88
import java.nio.file.Path
99

1010
@Description('The `co2footprint.trace` scope allows you to configure the trace file of the `nf-co2footprint` plugin.')
11-
class TraceFileConfig extends BaseFileConfig implements ConfigScope{
11+
class TraceFileConfig extends BaseFileConfig implements ConfigScope {
1212

1313
@ConfigOption
1414
@Description('Path to the file.')
15-
Path file
15+
final Path file
1616

1717
@ConfigOption
1818
@Description('Whether to enable the file creation.')
19-
Boolean enabled
19+
final Boolean enabled
2020

2121
@ConfigOption
2222
@Description('Whether to overwrite a file if it already exists.')
23-
Boolean overwrite
24-
23+
final Boolean overwrite
24+
2525
TraceFileConfig(Map traceFileConfig, String timestamp=null) {
2626
super('trace', 'txt')
27-
27+
2828
file = defineFile(traceFileConfig, timestamp)
29-
enabled = defineEnabled(traceFileConfig)
29+
enabled = defineEnabled(traceFileConfig)
3030
overwrite = defineOverwrite(traceFileConfig)
3131

3232
CO2FootprintConfig.checkKeyUsage(traceFileConfig, usedKeys)

0 commit comments

Comments
 (0)