Skip to content

Commit

Permalink
feat: ensure code is formatted and imports are sorted before commit
Browse files Browse the repository at this point in the history
  • Loading branch information
epochcoder committed Jan 4, 2025
1 parent 1c21b8d commit d2aa051
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hooks/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Copyright 2009-2025 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

# ensure code is formatted correctly and that imports are sorted as some IDE's automatically change it before commit
mvn formatter:format impsort:sort
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<mockito.version>5.15.2</mockito.version>
<mssql-jdbc.version>12.8.1.jre11</mssql-jdbc.version>
<testcontainers.version>1.20.4</testcontainers.version>
<git-build-hook.version>3.5.0</git-build-hook.version>

<!-- Add slow test groups here and annotate classes similar to @Tag('groupName'). -->
<!-- Excluded groups are ran on github ci, to force here, pass -d"excludedGroups=" -->
Expand Down Expand Up @@ -419,6 +420,24 @@
</rules>
</configuration>
</plugin>

<plugin>
<groupId>com.rudikershaw.gitbuildhook</groupId>
<artifactId>git-build-hook-maven-plugin</artifactId>
<version>${git-build-hook.version}</version>
<configuration>
<installHooks>
<pre-commit>hooks/pre-commit.sh</pre-commit>
</installHooks>
</configuration>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit d2aa051

Please sign in to comment.