Skip to content

Commit ca95dd7

Browse files
authored
build: add copyright header checks using maven checkstyle plugin (#5649)
* style: fix whitespaces * build: add basic regex header checks * build: relax criteria to better match the current headers * style: fix copyright headers year * style: fix copyright headers style * style: fix copyright header style * chore: migrate file from EPL1.0 to EPL2.0 * chore: added missing copyright header * chore: various copyright header fixes * chore: migrate from EPL1.0 to EPL2.0 * build: forgot to escape a couple of `.`
1 parent 5d52466 commit ca95dd7

File tree

24 files changed

+158
-102
lines changed

24 files changed

+158
-102
lines changed

checkstyle_checks.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@
2020
<property name="fileExtensions" value="java"/>
2121
<property name="message" value="Do not use Windows line endings"/>
2222
</module>
23-
23+
2424
<!-- Checks whether files end with a new line. -->
2525
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
2626
<!--<module name="NewlineAtEndOfFile"/>-->
27-
27+
2828
<!-- Checks that property files contain the same keys. -->
2929
<!-- See https://checkstyle.org/config_misc.html#Translation -->
3030
<module name="Translation"/>
31-
31+
3232
<!-- Checks for Size Violations. -->
3333
<!-- See https://checkstyle.org/config_sizes.html -->
3434
<module name="FileLength"/>
35-
35+
3636
<!-- Checks for whitespace -->
3737
<!-- See https://checkstyle.org/config_whitespace.html -->
3838
<module name="FileTabCharacter"/>
39-
39+
4040
<!-- Miscellaneous other checks. -->
4141
<!-- See https://checkstyle.org/config_misc.html -->
4242
<module name="RegexpSingleline">
@@ -45,19 +45,19 @@
4545
<property name="maximum" value="0"/>
4646
<property name="message" value="Line has trailing spaces."/>
4747
</module>
48-
48+
4949
<!-- Checks for Headers -->
5050
<!-- See https://checkstyle.org/config_header.html -->
51-
<module name="Header">
52-
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
51+
<module name="RegexpHeader">
52+
<property name="headerFile" value="header.txt"/>
5353
<property name="fileExtensions" value="java"/>
5454
</module>
5555

5656
<module name="SuppressWarningsFilter"/>
57-
57+
5858
<module name="TreeWalker">
5959
<module name="SuppressWarningsHolder" />
60-
60+
6161
<!-- Checks for Javadoc comments. -->
6262
<!-- See https://checkstyle.org/config_javadoc.html -->
6363
<!--<module name="InvalidJavadocPosition"/>
@@ -70,8 +70,8 @@
7070
<!-- Checks for Naming Conventions. -->
7171
<!-- See https://checkstyle.org/config_naming.html -->
7272
<module name="ConstantName">
73-
<property name="format" value="^auditLogger|log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
74-
</module>
73+
<property name="format" value="^auditLogger|log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
74+
</module>
7575
<module name="LocalFinalVariableName"/>
7676
<module name="LocalVariableName"/>
7777
<module name="MemberName"/>
@@ -80,7 +80,7 @@
8080
<module name="ParameterName"/>
8181
<module name="StaticVariableName"/>
8282
<module name="TypeName"/>
83-
83+
8484
<!-- Checks for imports -->
8585
<!-- See https://checkstyle.org/config_import.html -->
8686
<module name="AvoidStarImport"/>
@@ -90,15 +90,15 @@
9090
<module name="UnusedImports">
9191
<property name="processJavadoc" value="false"/>
9292
</module>
93-
93+
9494
<!-- Checks for Size Violations. -->
9595
<!-- See https://checkstyle.org/config_sizes.html -->
9696
<module name="LineLength">
97-
<property name="max" value="150"/>
97+
<property name="max" value="150"/>
9898
</module>
9999
<module name="MethodLength"/>
100100
<module name="ParameterNumber"/>
101-
101+
102102
<!-- Checks for whitespace -->
103103
<!-- See https://checkstyle.org/config_whitespace.html -->
104104
<module name="EmptyForIteratorPad"/>
@@ -113,20 +113,20 @@
113113
<module name="TypecastParenPad"/>
114114
<module name="WhitespaceAfter"/>
115115
<module name="WhitespaceAround"/>
116-
116+
117117
<!-- Modifier Checks -->
118118
<!-- See https://checkstyle.org/config_modifiers.html -->
119119
<module name="ModifierOrder"/>
120120
<!--<module name="RedundantModifier"/>-->
121-
121+
122122
<!-- Checks for blocks. You know, those {}'s -->
123123
<!-- See https://checkstyle.org/config_blocks.html -->
124124
<module name="AvoidNestedBlocks"/>
125125
<module name="EmptyBlock"/>
126126
<module name="LeftCurly"/>
127127
<module name="NeedBraces"/>
128128
<module name="RightCurly"/>
129-
129+
130130
<!-- Checks for common coding problems -->
131131
<!-- See https://checkstyle.org/config_coding.html -->
132132
<module name="EmptyStatement"/>
@@ -145,7 +145,7 @@
145145
<module name="MultipleVariableDeclarations"/>
146146
<module name="SimplifyBooleanExpression"/>
147147
<module name="SimplifyBooleanReturn"/>
148-
148+
149149
<!-- Checks for class design -->
150150
<!-- See https://checkstyle.org/config_design.html -->
151151
<!--<module name="DesignForExtension"/>-->
@@ -158,7 +158,7 @@
158158
<property name="packageAllowed" value="true" />
159159
<property name="protectedAllowed" value="true" />
160160
</module>
161-
161+
162162
<!-- Miscellaneous other checks. -->
163163
<!-- See https://checkstyle.org/config_misc.html -->
164164
<module name="ArrayTypeStyle"/>

header.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
^\/\*{2,}$
2+
^\s\* Copyright \(c\) (\d{4}|\d{4}, \d{4}) .+ (and/or its affiliates )?and others$
3+
^\s\*\s?$
4+
^\s\* This program and the accompanying materials are made$
5+
^\s\* available under the terms of the Eclipse Public License 2\.0$
6+
^\s\* which is available at https:\/\/www\.eclipse\.org\/legal\/epl-2\.0\/$
7+
^\s\*\s?$
8+
^\s\* SPDX-License-Identifier: EPL\-2\.0$
9+
^\s\*\s?$
10+
^\s\* Contributors:$
11+
^\s\* .+$

kura/examples/test/org.eclipse.kura.example.wire.logic.multiport.provider.test/src/main/java/org/eclipse/kura/example/wire/logic/multiport/provider/test/BoolLogicTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
/*******************************************************************************
2-
* Copyright (c) 2020 Eurotech and others
2+
* Copyright (c) 2020, 2025 Eurotech and/or its affiliates and others
33
*
4-
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
6-
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
87
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Eurotech
912
*******************************************************************************/
1013

1114
package org.eclipse.kura.example.wire.logic.multiport.provider.test;

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/bluetooth/le/beacon/AdvertisingReportPhy.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*******************************************************************************
2-
* Copyright (c) 2020 Eurotech and/or its affiliates
3-
*
4-
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
6-
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
2+
* Copyright (c) 2020, 2025 Eurotech and/or its affiliates and others
83
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
910
* Contributors:
10-
* Scott Ware
11+
* Scott Ware
12+
* Eurotech
1113
*******************************************************************************/
1214
package org.eclipse.kura.bluetooth.le.beacon;
1315

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/container/orchestration/PasswordRegistryCredentials.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022 Eurotech and/or its affiliates and others
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
9-
*
10-
* Contributors:
11-
* Eurotech
12-
*******************************************************************************/
2+
* Copyright (c) 2022, 2025 Eurotech and/or its affiliates and others
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Eurotech
12+
*******************************************************************************/
1313

1414
package org.eclipse.kura.container.orchestration;
1515

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/container/orchestration/RegistryCredentials.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022 Eurotech and/or its affiliates and others
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
9-
*
10-
* Contributors:
11-
* Eurotech
12-
*******************************************************************************/
2+
* Copyright (c) 2022, 2025 Eurotech and/or its affiliates and others
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Eurotech
12+
*******************************************************************************/
1313

1414
package org.eclipse.kura.container.orchestration;
1515

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/db/keyvalue/KeyValueDbService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
package org.eclipse.kura.db.keyvalue;
2-
31
/*******************************************************************************
4-
* Copyright (c) 2023 Eurotech and/or its affiliates and others
2+
* Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others
53
*
64
* This program and the accompanying materials are made
75
* available under the terms of the Eclipse Public License 2.0
@@ -12,6 +10,7 @@
1210
* Contributors:
1311
* Eurotech
1412
*******************************************************************************/
13+
package org.eclipse.kura.db.keyvalue;
1514

1615
import org.eclipse.kura.KuraException;
1716
import org.eclipse.kura.connection.listener.ConnectionListener;

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/status/ethernet/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 20230 Eurotech and/or its affiliates and others
2+
* Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/status/loopback/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 20230 Eurotech and/or its affiliates and others
2+
* Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/status/modem/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 20230 Eurotech and/or its affiliates and others
2+
* Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0

0 commit comments

Comments
 (0)