Skip to content

Commit 255f1ba

Browse files
authored
Merge pull request #9 from devopsix/checks
Add Checkstyle and SpotBugs
2 parents 4a11de6 + 941176e commit 255f1ba

File tree

71 files changed

+3670
-3479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+3670
-3479
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
root = true
22

3-
[*]
3+
[*.{yml,xml}]
44
end_of_line = lf
55
insert_final_newline = true
66
charset = utf-8
77
indent_style = space
8-
indent_size = 4
9-
10-
[*.yml]
118
indent_size = 2

.github/workflows/build.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,10 @@ jobs:
1313
with:
1414
distribution: 'zulu'
1515
java-version: 11
16-
- name: Build hamcrest-mail and hamcrest-mail-jakarta artifacts
16+
- name: Build and verify all modules
1717
run: >-
1818
mvn
1919
--batch-mode
20-
--activate-profiles=-examples
20+
--activate-profiles=checkstyle,spotbugs,coverage
2121
"-DrepoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
22-
install
23-
- name: Run tests in hamcrest-mail-examples and hamcrest-mail-examples-jakarta
24-
run: >-
25-
mvn
26-
--batch-mode
27-
--projects examples,examples-jakarta
28-
"-DrepoBaseUrl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
29-
test
22+
verify

DEVELOPMENT.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Requirements
2+
3+
* JDK 11 or newer (e.g. [OpenJDK](https://openjdk.org/))
4+
* [Apache Maven](https://maven.apache.org/) 3.3.9 or newer
5+
6+
# Code Style
7+
8+
This project adheres to [Google Java Style](https://google.github.io/styleguide/javaguide.html) and uses
9+
[Checkstyle](https://checkstyle.org/) for validating code style.
10+
11+
Run `mvn --activate-profiles=checkstyle verify` to execute Checkstyle.
12+
13+
Use [google_checks.xml](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml)
14+
for configuring your IDE's inspection and formatting settings.
15+
16+
# Static Code Analysis
17+
18+
This project uses [SpotBugs](https://spotbugs.github.io/) for static code analysis.
19+
20+
Run `mvn --activate-profiles=spotbugs verify` to execute SpotBugs.
21+
22+
# Testing
23+
24+
Run `mvn --activate-profiles=coverage verify` to execute all tests and to assert code coverage requirements are met.
25+
26+
# Building
27+
28+
Run `mvn --activate-profiles=checkstyle,spotbugs,coverage verify` to build all modules, execute all tests
29+
and run all checks.
30+
31+
Run `mvn --activate-profiles=-examples install` to install the main artifacts into the local repository.
32+
33+
# Code Generation
34+
35+
The code for the hamcrest-mail-jakarta and hamcrest-mail-examples-jakarta modules is “generated” from their non-Jakarta
36+
counterparts by copying source files and substituting “jakarta.mail” for “javax.mail”.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Hamcrest Mail
66

77
Hamcrest Mail is an extension library for the [Java Hamcrest][] matcher library.
8-
It provides matchers for types from the javax.mail and jakarta.mail packages.
8+
It provides matchers for types from the `javax.mail` and `jakarta.mail` packages.
99

1010
The [assertj-mail][] sister project provides a set of AssertJ assertions with similar features.
1111

checkstyle-suppressions.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
6+
7+
<suppressions>
8+
<suppress checks="MissingJavadocType"
9+
files="src[/\\]test[/\\]java[/\\].*\.java"/>
10+
<suppress checks="MissingJavadocMethod"
11+
files="src[/\\]test[/\\]java[/\\].*\.java"/>
12+
</suppressions>

examples/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,39 @@
110110
</plugins>
111111
</build>
112112

113+
<profiles>
114+
<profile>
115+
<id>checkstyle</id>
116+
<activation>
117+
<activeByDefault>false</activeByDefault>
118+
</activation>
119+
<build>
120+
<plugins>
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-checkstyle-plugin</artifactId>
124+
<executions>
125+
<execution>
126+
<id>check</id>
127+
<phase>verify</phase>
128+
<goals>
129+
<goal>check</goal>
130+
</goals>
131+
<configuration>
132+
<configLocation>google_checks.xml</configLocation>
133+
<consoleOutput>true</consoleOutput>
134+
<failOnViolation>true</failOnViolation>
135+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
136+
<logViolationsToConsole>true</logViolationsToConsole>
137+
<suppressionsLocation>${project.basedir}/../checkstyle-suppressions.xml</suppressionsLocation>
138+
<violationSeverity>warning</violationSeverity>
139+
</configuration>
140+
</execution>
141+
</executions>
142+
</plugin>
143+
</plugins>
144+
</build>
145+
</profile>
146+
</profiles>
147+
113148
</project>

0 commit comments

Comments
 (0)