1
1
/*
2
- * Copyright 2016-2023 DiffPlug
2
+ * Copyright 2016-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -120,14 +120,12 @@ public LicenseHeaderStep withSkipLinesMatching(@Nullable String skipLinesMatchin
120
120
}
121
121
122
122
public FormatterStep build () {
123
- FormatterStep formatterStep = null ;
124
-
123
+ FormatterStep formatterStep ;
125
124
if (yearMode .get () == YearMode .SET_FROM_GIT ) {
126
- formatterStep = FormatterStep .createNeverUpToDateLazy (name , () -> {
125
+ formatterStep = FormatterStep .createLazy (name , () -> {
127
126
boolean updateYear = false ; // doesn't matter
128
- Runtime runtime = new Runtime (headerLazy .get (), delimiter , yearSeparator , updateYear , skipLinesMatching );
129
- return FormatterFunc .needsFile (runtime ::setLicenseHeaderYearsFromGitHistory );
130
- });
127
+ return new Runtime (headerLazy .get (), delimiter , yearSeparator , updateYear , skipLinesMatching );
128
+ }, step -> FormatterFunc .needsFile (step ::format ));
131
129
} else {
132
130
formatterStep = FormatterStep .createLazy (name , () -> {
133
131
// by default, we should update the year if the user is using ratchetFrom
@@ -146,11 +144,9 @@ public FormatterStep build() {
146
144
return new Runtime (headerLazy .get (), delimiter , yearSeparator , updateYear , skipLinesMatching );
147
145
}, step -> FormatterFunc .needsFile (step ::format ));
148
146
}
149
-
150
147
if (contentPattern == null ) {
151
148
return formatterStep ;
152
149
}
153
-
154
150
return formatterStep .filterByContent (OnMatch .INCLUDE , contentPattern );
155
151
}
156
152
0 commit comments