Skip to content

Commit

Permalink
Merge pull request #85 from BorderTech/feature/failproperty
Browse files Browse the repository at this point in the history
bt.qa.fail property and latest versions
  • Loading branch information
jonathanaustin authored Feb 10, 2022
2 parents 8f9e1c0 + 0bed23b commit 9bb405d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change log

## Release in-progress
* Added bt.qa.fail property as a convenience property to allow projects to fail builds or only report QA violations. #84
* 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
* Update PMD and Checkstyle to latest versions

## 1.0.18
* Default QA plugins to ignore generated code #61
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ By default qa checks do not run, you must enable them on a per-module basis or i
</property>
```

The qa-parent default is to fail the build if QA violations are found. This can be overridden by setting the following property:

``` xml
<property>
<bt.qa.fail>false</bt.qa.fail>
</property>
```

Use the following to run the qa-parent verification:

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

#### Failing Build with QA Violations

The qa-parent default is to fail the build if QA violations are found. This can be overridden by setting the following property:

``` xml
<property>
<bt.qa.fail>false</bt.qa.fail>
</property>
```

#### Generated Sources

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

``` xml
<property>
<enforcer.fail>false</enforcer.fail>
<bt.convergence.check.fail>false</bt.convergence.check.fail>
</property>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

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

<!--
Checkstyle configuration that checks the sun coding conventions from:
Expand Down
3 changes: 3 additions & 0 deletions build-tools/src/main/resources/bordertech/bt-pmd-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<rule ref="category/java/codestyle.xml/ClassNamingConventions" >
<priority>3</priority>
</rule>
<rule ref="category/java/codestyle.xml/FinalParameterInAbstractMethod" >
<priority>3</priority>
</rule>
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod">
<priority>3</priority>
</rule>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
Descendants outside the java-common project SHOULD override this section.
-->
<ciManagement>
<system>Travis CI</system>
<url>https://travis-ci.com/BorderTech/java-common</url>
<system>Github Actions</system>
<url>https://github.com/BorderTech/java-common/actions</url>
</ciManagement>

<!-- developers is a required section for Maven Central -->
Expand Down
21 changes: 16 additions & 5 deletions qa-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
<dependency-check.skip>${bt.qa.skip}</dependency-check.skip>
<bt.convergence.check.skip>${bt.qa.skip}</bt.convergence.check.skip>

<!-- FAIL QA -->
<bt.qa.fail>true</bt.qa.fail>
<checkstyle.failOnViolation>${bt.qa.fail}</checkstyle.failOnViolation>
<pmd.failOnViolation>${bt.qa.fail}</pmd.failOnViolation>
<spotbugs.failOnError>${bt.qa.fail}</spotbugs.failOnError>
<!-- OWASP -->
<failOnError>${bt.qa.fail}</failOnError>
<!-- Convergence Check -->
<bt.convergence.check.fail>${bt.qa.fail}</bt.convergence.check.fail>
<!-- CPD (Default to report only) -->
<cpd.failOnViolation>false</cpd.failOnViolation>

<!--
These plugin settings are set as properties instead of being included in the default configuration to make it easier for projects to override.
Property values are ignored if a default value is set in a configuation.
Expand All @@ -43,8 +55,6 @@
<bt.pmd.rules.file>bordertech/bt-pmd-rules.xml</bt.pmd.rules.file>
<!-- Override default to only use main src (ignore generated) -->
<bt.pmd.src>${project.build.sourceDirectory}</bt.pmd.src>
<!-- CPD (Default to report only) -->
<cpd.failOnViolation>false</cpd.failOnViolation>

<!-- Spotbugs -->
<!-- Effort -->
Expand Down Expand Up @@ -80,9 +90,9 @@
<bt.jacoco.plugin.version>0.8.7</bt.jacoco.plugin.version>
<bt.surefire.plugin.version>2.22.2</bt.surefire.plugin.version>
<bt.checkstyle.plugin.version>3.1.2</bt.checkstyle.plugin.version>
<bt.checkstyle.version>9.2.1</bt.checkstyle.version>
<bt.checkstyle.version>9.3</bt.checkstyle.version>
<bt.pmd.plugin.version>3.15.0</bt.pmd.plugin.version>
<bt.pmd.version>6.41.0</bt.pmd.version>
<bt.pmd.version>6.42.0</bt.pmd.version>
<bt.spotbugs.plugin.version>4.5.3.0</bt.spotbugs.plugin.version>
<bt.sb-contrib.plugin.version>7.4.7</bt.sb-contrib.plugin.version>
<bt.spotbugs.version>4.5.3</bt.spotbugs.version>
Expand Down Expand Up @@ -375,8 +385,9 @@
<rules>
<dependencyConvergence />
</rules>
<!-- Use a different skip property to not override and skip the enforcer plugin in bordertech_parent. -->
<!-- Use a different skip and fail property to not override the enforcer plugin in bordertech_parent. -->
<skip>${bt.convergence.check.skip}</skip>
<fail>${bt.convergence.check.fail}</fail>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 9bb405d

Please sign in to comment.