Skip to content

Commit 0a0dc71

Browse files
author
Quintin Willison
committed
Add Checkstyle with just one rule enabled.
1 parent 192c8d1 commit 0a0dc71

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,16 @@ The Android-specific library AAR is built with:
487487

488488
(The `ANDROID_HOME` environment variable must be set appropriately.)
489489

490+
## Code Standard
491+
492+
We are introducing [Checkstyle](https://checkstyle.org/) to enforce code style and spot for transgressions and illogical constructs.
493+
The Gradle build has been configured to run these on `java:assembleRelease`.
494+
It does not run for the Android build yet.
495+
496+
You can run just the Checkstyle rules on their own using:
497+
498+
./gradlew checkstyleMain
499+
490500
## Tests
491501

492502
A gradle wrapper is included so these tasks can run without any prior installation of gradle. The Linux/OSX form of the commands, given below, is:

config/checkstyle/checkstyle.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+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<module name="Checker">
7+
<property name="charset" value="UTF-8"/>
8+
9+
<module name="TreeWalker">
10+
<module name="RedundantModifier"/>
11+
</module>
12+
</module>

java/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ buildscript {
66

77
plugins {
88
id 'de.fuerstenau.buildconfig' version '1.1.8'
9+
id 'checkstyle'
910
}
1011

1112
apply plugin: 'java'
@@ -64,6 +65,7 @@ task fullJar(type: Jar) {
6465
}
6566

6667
assemble.dependsOn fullJar
68+
assembleRelease.dependsOn checkstyleMain
6769

6870
configurations {
6971
fullConfiguration

0 commit comments

Comments
 (0)