Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xerial/sbt-jcheckstyle
A sbt plugin for checking Java code styles
https://github.com/xerial/sbt-jcheckstyle
checkstyle java sbt-plugin scala
Last synced: 3 months ago
JSON representation
A sbt plugin for checking Java code styles
- Host: GitHub
- URL: https://github.com/xerial/sbt-jcheckstyle
- Owner: xerial
- Created: 2015-06-17T15:12:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T05:49:36.000Z (about 7 years ago)
- Last Synced: 2024-06-19T00:19:01.890Z (7 months ago)
- Topics: checkstyle, java, sbt-plugin, scala
- Language: Shell
- Size: 52.7 KB
- Stars: 6
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sbt-jcheckstyle
A sbt plugin for checking Java code styles with [checkstyle](http://checkstyle.sourceforge.net/).## Usage
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.xerial.sbt/sbt-jcheckstyle/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.xerial.sbt/sbt-jcheckstyle)Add sbt-jcheckstyle plugin to your `project/plugins.sbt`, then run `jcheckStyle` task:
**project/plugins.sbt**
```
// For sbt-0.13.x and 1.0.x
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "(version)")
``````
# Check code style of java codes
$ sbt jcheckStyle# Check code style of java test codes
$ sbt test:jcheckStyle
```### Run style check before compilation
Add the following sbt settings:
```
compile in Compile <<= (compile in Compile) dependsOn (jcheckStyle in Compile)
compile in Test <<= (compile in Test) dependsOn (jcheckStyle in Test)
```## Style configuration
To configure Java code style, edit `jcheckStyleConfig` setting. In default, it uses Google's Java style:
```
jcheckStyleConfig := "google" // or "facebook", "sun" or path to your checkstyle.xml
```Here is the list of the available styles:
* `google`: [Google's Java Style](https://google.github.io/styleguide/javaguide.html). [checkstyle.xml](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml)
* [IntelliJ setting file](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml)
* `facebook` : [Code style used in Facebook Presto](https://github.com/facebook/presto/blob/master/src/checkstyle/checks.xml)
* [IntelliJ setting file](https://raw.githubusercontent.com/airlift/codestyle/master/IntelliJIdea13/Airlift.xml)
* `sun`: [Code Conventions for the Java TM Programming Language](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html).
[checkstyle.xml](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml)Or you can specify your own configuration:
```
jcheckStyleConfig := "checkstyle.xml"
```