41 lines
2.1 KiB
Markdown
41 lines
2.1 KiB
Markdown
# [Checkstyle](https://checkstyle.sourceforge.io/) Extension for [b<span style="color:orange">l</span>d](https://rife2.com/bldb)
|
|
|
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
|
[](https://rife2.com/bld)
|
|
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-checkstyle)
|
|
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-checkstyle)
|
|
[](https://github.com/rife2/bld-checkstyle/actions/workflows/bld.yml)
|
|
|
|
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
|
|
|
To check your code with Chesktyle, include the following in your build file:
|
|
|
|
```java
|
|
@BuildCommand(summary = "Check code style")
|
|
public void checkstyle() throws Exception {
|
|
new CheckstyleOperation()
|
|
.fromProject(this)
|
|
.configurationFile("config/sun_checks.xml")
|
|
.execute();
|
|
}
|
|
```
|
|
|
|
```console
|
|
./bld checkstyle
|
|
```
|
|
|
|
- [View Examples](https://github.com/rife2/bld-checkstyle/blob/master/examples/src/bld/java/com/example/)
|
|
|
|
Please check the [CheckstyleOperation documentation](https://rife2.github.io/bld-checkstyle/rife/bld/extension/CheckstyleOperation.html#method-summary)
|
|
for all available configuration options.
|
|
|
|
## Checkstyle Dependency
|
|
|
|
Don't forget to add a Checkstyle `test` dependency to your build file, as it is
|
|
not provided by the extension. For example:
|
|
|
|
```java
|
|
repositories = List.of(MAVEN_CENTRAL);
|
|
scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0)));
|
|
```
|