Skip to content

Commit 8e31127

Browse files
committed
style: move checkstyle to config/checkstyle and add regex header check
1 parent d38add0 commit 8e31127

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ tasks.test {
9393
}
9494

9595
checkstyle {
96-
toolVersion = "10.17.0"
97-
configFile = file("checkstyle.xml")
98-
}
96+
toolVersion = "10.17.0"
97+
configFile = file("config/checkstyle/checkstyle.xml")
98+
configProperties["checkstyle.config.location"] = "${project.rootDir}/config/checkstyle"
99+
}
99100

100101
tasks.checkstyleMain {
101102
reports {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<module name="Checker">
77
<property name="severity" value="warning"/>
88
<property name="fileExtensions" value="java"/>
9+
10+
<module name="RegexpHeader">
11+
<property name="headerFile" value="${checkstyle.config.location}/license_header.txt"/>
12+
</module>
913

1014
<module name="TreeWalker">
1115
<module name="NeedBraces">
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
^/\*$
2+
^ \* Copyright \d{4}(-\d{4})? +Damon +Lu and open-source contributors$
3+
^ \*$
4+
^ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\)\;$
5+
^ \* you may not use this file except in compliance with the License.$
6+
^ \* You may obtain a copy of the License at$
7+
^ \*$
8+
^ \* http://www\.apache\.org/licenses/LICENSE\-2\.0$
9+
^ \*$
10+
^ \* Unless required by applicable law or agreed to in writing, software$
11+
^ \* distributed under the License is distributed on an "AS IS" BASIS,$
12+
^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
13+
^ \* See the License for the specific language governing permissions and$
14+
^ \* limitations under the License\.$
15+
^ \*/$

src/main/java/org/damon233/performtrackermod/network/UdpMetricsClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2026 Damon Lu and open-source contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.damon233.performtrackermod.network;
218

319
import org.damon233.performtrackermod.PerformTracker;

0 commit comments

Comments
 (0)