Skip to content

Commit b94046d

Browse files
mziccardaozarov
authored andcommitted
Add automatic check for file header on mvn validate (#1103)
Add automatic check (regexp) for file header on mvn validate and fix invalid license headers.
1 parent 3276dfb commit b94046d

9 files changed

Lines changed: 83 additions & 32 deletions

File tree

gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright 2015 Google Inc. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5-
* in compliance with the License. You may obtain a copy of the License at
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
67
*
7-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
89
*
9-
* Unless required by applicable law or agreed to in writing, software distributed under the License
10-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11-
* or implied. See the License for the specific language governing permissions and limitations under
12-
* the License.
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.
1315
*/
1416

1517
package com.google.cloud.bigquery.spi;

gcloud-java-contrib/gcloud-java-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Copyright 2016 Google Inc. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file exctain a copy of the License at
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
67
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
9-
* Unept in compliance with the License.
10-
* You may obless required by applicable law or agreed to in writing, software
10+
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and

gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/Message.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright 2016 Google Inc. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5-
* in compliance with the License. You may obtain a copy of the License at
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
67
*
7-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
89
*
9-
* Unless required by applicable law or agreed to in writing, software distributed under the License
10-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11-
* or implied. See the License for the specific language governing permissions and limitations under
12-
* the License.
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.
1315
*/
1416

1517
package com.google.cloud.pubsub;

gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ProjectInfo.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright 2015 Google Inc. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5-
* in compliance with the License. You may obtain a copy of the License at
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
67
*
7-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
89
*
9-
* Unless required by applicable law or agreed to in writing, software distributed under the License
10-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11-
* or implied. See the License for the specific language governing permissions and limitations under
12-
* the License.
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.
1315
*/
1416

1517
package com.google.cloud.resourcemanager;

gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageBatchResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright 2016 Google Inc. All Rights Reserved.
43
*

gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
22
* Copyright 2015 Google Inc. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5-
* in compliance with the License. You may obtain a copy of the License at
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
67
*
7-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
89
*
9-
* Unless required by applicable law or agreed to in writing, software distributed under the License
10-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11-
* or implied. See the License for the specific language governing permissions and limitations under
12-
* the License.
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.
1315
*/
1416

1517
package com.google.cloud.storage.spi;

java.header

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
^/\*$
2+
^ \* Copyright \d\d\d\d Google Inc\. All Rights Reserved\.$
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+
^ \*/$

license-checks.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="RegexpHeader">
7+
<property name="fileExtensions" value="java"/>
8+
<property name="headerFile" value="${checkstyle.header.file}"/>
9+
</module>
10+
</module>

pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,25 @@
305305
<version>6.15</version>
306306
</dependency>
307307
</dependencies>
308+
<executions>
309+
<execution>
310+
<id>checkstyle</id>
311+
<phase>validate</phase>
312+
<goals>
313+
<goal>check</goal>
314+
</goals>
315+
<configuration>
316+
<headerLocation>java.header</headerLocation>
317+
<configLocation>license-checks.xml</configLocation>
318+
<consoleOutput>true</consoleOutput>
319+
<failOnViolation>true</failOnViolation>
320+
<violationSeverity>error</violationSeverity>
321+
<failsOnError>true</failsOnError>
322+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
323+
<excludes>com/google/cloud/*/spi/v*/*</excludes><!-- We need to exclude autogenerated code -->
324+
</configuration>
325+
</execution>
326+
</executions>
308327
</plugin>
309328
<plugin>
310329
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)