Skip to content

Commit 9bb405d

Browse files
Merge pull request #85 from BorderTech/feature/failproperty
bt.qa.fail property and latest versions
2 parents 8f9e1c0 + 0bed23b commit 9bb405d

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change log
22

33
## Release in-progress
4+
* Added bt.qa.fail property as a convenience property to allow projects to fail builds or only report QA violations. #84
5+
* Added bt.convergence.check.fail property to allow the convergence check to be set to fail without overriding the enforcer plugin in bordertech_parent. #84
6+
* Update PMD and Checkstyle to latest versions
47

58
## 1.0.18
69
* Default QA plugins to ignore generated code #61

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ By default qa checks do not run, you must enable them on a per-module basis or i
5151
</property>
5252
```
5353

54+
The qa-parent default is to fail the build if QA violations are found. This can be overridden by setting the following property:
55+
56+
``` xml
57+
<property>
58+
<bt.qa.fail>false</bt.qa.fail>
59+
</property>
60+
```
61+
5462
Use the following to run the qa-parent verification:
5563

5664
``` java
@@ -151,6 +159,16 @@ By default qa checks (i.e. Checkstyle, PMD, Spotbugs, OWASP, Convergence Check)
151159
</property>
152160
```
153161

162+
#### Failing Build with QA Violations
163+
164+
The qa-parent default is to fail the build if QA violations are found. This can be overridden by setting the following property:
165+
166+
``` xml
167+
<property>
168+
<bt.qa.fail>false</bt.qa.fail>
169+
</property>
170+
```
171+
154172
#### Generated Sources
155173

156174
By default, qa-parent configures the code analysis plugins to ignore generated source code and only analyse the project's main source directory.
@@ -392,7 +410,7 @@ Refer to [enforcer plugin](https://maven.apache.org/enforcer/maven-enforcer-plug
392410

393411
``` xml
394412
<property>
395-
<enforcer.fail>false</enforcer.fail>
413+
<bt.convergence.check.fail>false</bt.convergence.check.fail>
396414
</property>
397415
```
398416

build-tools/src/main/resources/bordertech/bt-checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
44
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

6-
<!-- Based on sun_checks.xml V9.2.1 (https://github.com/checkstyle/checkstyle/blob/checkstyle-9.2.1/src/main/resources/sun_checks.xml) -->
6+
<!-- Based on sun_checks.xml V9.3 (https://github.com/checkstyle/checkstyle/blob/checkstyle-9.3/src/main/resources/sun_checks.xml) -->
77

88
<!--
99
Checkstyle configuration that checks the sun coding conventions from:

build-tools/src/main/resources/bordertech/bt-pmd-rules.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<rule ref="category/java/codestyle.xml/ClassNamingConventions" >
2828
<priority>3</priority>
2929
</rule>
30+
<rule ref="category/java/codestyle.xml/FinalParameterInAbstractMethod" >
31+
<priority>3</priority>
32+
</rule>
3033
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod">
3134
<priority>3</priority>
3235
</rule>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
Descendants outside the java-common project SHOULD override this section.
7171
-->
7272
<ciManagement>
73-
<system>Travis CI</system>
74-
<url>https://travis-ci.com/BorderTech/java-common</url>
73+
<system>Github Actions</system>
74+
<url>https://github.com/BorderTech/java-common/actions</url>
7575
</ciManagement>
7676

7777
<!-- developers is a required section for Maven Central -->

qa-parent/pom.xml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
<dependency-check.skip>${bt.qa.skip}</dependency-check.skip>
2525
<bt.convergence.check.skip>${bt.qa.skip}</bt.convergence.check.skip>
2626

27+
<!-- FAIL QA -->
28+
<bt.qa.fail>true</bt.qa.fail>
29+
<checkstyle.failOnViolation>${bt.qa.fail}</checkstyle.failOnViolation>
30+
<pmd.failOnViolation>${bt.qa.fail}</pmd.failOnViolation>
31+
<spotbugs.failOnError>${bt.qa.fail}</spotbugs.failOnError>
32+
<!-- OWASP -->
33+
<failOnError>${bt.qa.fail}</failOnError>
34+
<!-- Convergence Check -->
35+
<bt.convergence.check.fail>${bt.qa.fail}</bt.convergence.check.fail>
36+
<!-- CPD (Default to report only) -->
37+
<cpd.failOnViolation>false</cpd.failOnViolation>
38+
2739
<!--
2840
These plugin settings are set as properties instead of being included in the default configuration to make it easier for projects to override.
2941
Property values are ignored if a default value is set in a configuation.
@@ -43,8 +55,6 @@
4355
<bt.pmd.rules.file>bordertech/bt-pmd-rules.xml</bt.pmd.rules.file>
4456
<!-- Override default to only use main src (ignore generated) -->
4557
<bt.pmd.src>${project.build.sourceDirectory}</bt.pmd.src>
46-
<!-- CPD (Default to report only) -->
47-
<cpd.failOnViolation>false</cpd.failOnViolation>
4858

4959
<!-- Spotbugs -->
5060
<!-- Effort -->
@@ -80,9 +90,9 @@
8090
<bt.jacoco.plugin.version>0.8.7</bt.jacoco.plugin.version>
8191
<bt.surefire.plugin.version>2.22.2</bt.surefire.plugin.version>
8292
<bt.checkstyle.plugin.version>3.1.2</bt.checkstyle.plugin.version>
83-
<bt.checkstyle.version>9.2.1</bt.checkstyle.version>
93+
<bt.checkstyle.version>9.3</bt.checkstyle.version>
8494
<bt.pmd.plugin.version>3.15.0</bt.pmd.plugin.version>
85-
<bt.pmd.version>6.41.0</bt.pmd.version>
95+
<bt.pmd.version>6.42.0</bt.pmd.version>
8696
<bt.spotbugs.plugin.version>4.5.3.0</bt.spotbugs.plugin.version>
8797
<bt.sb-contrib.plugin.version>7.4.7</bt.sb-contrib.plugin.version>
8898
<bt.spotbugs.version>4.5.3</bt.spotbugs.version>
@@ -375,8 +385,9 @@
375385
<rules>
376386
<dependencyConvergence />
377387
</rules>
378-
<!-- Use a different skip property to not override and skip the enforcer plugin in bordertech_parent. -->
388+
<!-- Use a different skip and fail property to not override the enforcer plugin in bordertech_parent. -->
379389
<skip>${bt.convergence.check.skip}</skip>
390+
<fail>${bt.convergence.check.fail}</fail>
380391
</configuration>
381392
</execution>
382393
</executions>

0 commit comments

Comments
 (0)