Skip to content

Commit 4fb73ea

Browse files
authored
HBASE-29085 [hbase-thirdparty] Add spotless plugin (#129)
Signed-off-by: Nihal Jain <[email protected]>
1 parent 648fa87 commit 4fb73ea

File tree

12 files changed

+560
-12
lines changed

12 files changed

+560
-12
lines changed

CHANGES.md

-1
Original file line numberDiff line numberDiff line change
@@ -466,4 +466,3 @@
466466
| JIRA | Summary | Priority | Component |
467467
|:---- |:---- | :--- |:---- |
468468
| [HBASE-23052](https://issues.apache.org/jira/browse/HBASE-23052) | hbase-thirdparty version of GSON that works for branch-1 | Blocker | dependencies |
469-

RELEASENOTES.md

-3
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,3 @@ These release notes cover new developer and user-facing incompatibilities, impor
616616
HBase's internal use of GSON is now done in a stand alone module named `hbase-shaded-gson` rather than as a part of the `hbase-shaded-miscellaneous` module. The relocated fully qualified class names are still the same.
617617

618618
This internal artifact is also set to maintain JDK bytecode compatibility as appropriate for use with branches-1 based releases in addition to the existing use in later release lines.
619-
620-
621-

dev-support/eclipse.importorder

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. 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+
#Organize Import Order
16+
3=org.apache.hadoop.hbase.shaded
17+
2=org.apache.hbase.thirdparty
18+
1=
19+
0=\#

dev-support/hbase_eclipse_formatter.xml

+418
Large diffs are not rendered by default.

dev-support/license-header

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/

hbase-noop-htrace/src/test/java/org/apache/hbase/htrace_noop/TestHBaseTestingUtilityWithHTraceNoop.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/**
2-
*
1+
/*
32
* Licensed to the Apache Software Foundation (ASF) under one
43
* or more contributor license agreements. See the NOTICE file
54
* distributed with this work for additional information

hbase-shaded-netty/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@
9898
property so netty finds the renamed .so and associates it w/ the relocated netty files.
9999
100100
Add this define when running unit tests:
101-
101+
102102
mvn test -Dorg.apache.hbase.thirdparty.io.netty.packagePrefix=org.apache.hbase.thirdparty. -Dtest=TestNettyIPC
103103
104104
See toward the end of this issue for how to pass config:
105-
105+
106106
https://github.com/netty/netty/issues/6665
107107
108108
TODO: Ensure native works.

hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBasePlatformDependent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information

hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseSignalInternal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information

hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafeInternal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information

hbase-unsafe/src/test/java/org/apache/hadoop/hbase/unsafe/TestHBaseUnsafe.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information

pom.xml

+99
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
<jakarta.validation-api.version>2.0.2</jakarta.validation-api.version>
152152
<javassist.version>3.30.2-GA</javassist.version>
153153
<jackson-jaxrs-json-provider.version>2.17.3</jackson-jaxrs-json-provider.version>
154+
<spotless.version>2.44.2</spotless.version>
154155
</properties>
155156
<build>
156157
<pluginManagement>
@@ -394,6 +395,104 @@
394395
</execution>
395396
</executions>
396397
</plugin>
398+
<plugin>
399+
<groupId>com.diffplug.spotless</groupId>
400+
<artifactId>spotless-maven-plugin</artifactId>
401+
<version>${spotless.version}</version>
402+
<configuration>
403+
<!-- define a language-specific format -->
404+
<java>
405+
<includes>
406+
<include>**/org/apache/hbase/htrace_noop/**</include>
407+
<include>**/org/apache/hadoop/hbase/unsafe/**</include>
408+
</includes>
409+
<!--
410+
e.g., remove the following lines:
411+
"* @param paramName"
412+
"* @throws ExceptionType"
413+
"* @return returnType"'
414+
Multiline to allow anchors on newlines
415+
See https://errorprone.info/bugpattern/EmptyBlockTag
416+
-->
417+
<replaceRegex>
418+
<name>Remove unhelpful javadoc stubs</name>
419+
<searchRegex>(?m)^ *\* *@(?:param|throws|return) *\w* *\n</searchRegex>
420+
<replacement/>
421+
</replaceRegex>
422+
<!--
423+
e.g., rewrite
424+
/** @return blabla */
425+
or
426+
/**
427+
* @return blabla
428+
*/
429+
to
430+
/** Returns blabla */
431+
See https://errorprone.info/bugpattern/MissingSummary
432+
https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment
433+
-->
434+
<replaceRegex>
435+
<name>Purge single returns tag multi line</name>
436+
<searchRegex>(?m)^ */\*\*\n *\* *@return *(.*) *\n *\*/$</searchRegex>
437+
<replacement>/** Returns $1 */</replacement>
438+
</replaceRegex>
439+
<replaceRegex>
440+
<name>Purge single returns tag single line</name>
441+
<searchRegex>^ */\*\* *@return *(.*) *\*/$</searchRegex>
442+
<replacement>/** Returns $1 */</replacement>
443+
</replaceRegex>
444+
<!-- apply a specific flavor -->
445+
<eclipse>
446+
<file>${session.executionRootDirectory}/dev-support/hbase_eclipse_formatter.xml</file>
447+
</eclipse>
448+
<importOrder>
449+
<file>${session.executionRootDirectory}/dev-support/eclipse.importorder</file>
450+
</importOrder>
451+
<trimTrailingWhitespace/>
452+
<endWithNewline/>
453+
<removeUnusedImports/>
454+
</java>
455+
<pom>
456+
<sortPom>
457+
<expandEmptyElements>false</expandEmptyElements>
458+
</sortPom>
459+
</pom>
460+
<formats>
461+
<!-- you can define as many formats as you want, each is independent -->
462+
<format>
463+
<!-- define the files to apply to -->
464+
<includes>
465+
<include>**/*.xml</include>
466+
<include>**/*.sh</include>
467+
<include>**/*.py</include>
468+
<include>**/Jenkinsfile*</include>
469+
<include>**/*.md</include>
470+
<include>*.md</include>
471+
<include>**/*.txt</include>
472+
<include>*.txt</include>
473+
</includes>
474+
<excludes>
475+
<exclude>**/target/**</exclude>
476+
<exclude>**/dependency-reduced-pom.xml</exclude>
477+
<exclude>**/.idea/**</exclude>
478+
</excludes>
479+
<!-- define the steps to apply to those files -->
480+
<trimTrailingWhitespace/>
481+
<endWithNewline/>
482+
</format>
483+
<format>
484+
<includes>
485+
<include>**/org/apache/hbase/htrace_noop/**</include>
486+
<include>**/org/apache/hadoop/hbase/unsafe/**</include>
487+
</includes>
488+
<licenseHeader>
489+
<file>${session.executionRootDirectory}/dev-support/license-header</file>
490+
<delimiter>package</delimiter>
491+
</licenseHeader>
492+
</format>
493+
</formats>
494+
</configuration>
495+
</plugin>
397496
</plugins>
398497
<extensions>
399498
<extension>

0 commit comments

Comments
 (0)