/checkstyle4sbt

Java code style checker as a SBT plugin

Primary LanguageScalaMIT LicenseMIT

checkstyle4sbt - Java code style checker as an SBT plugin

This SBT plugin allows you to check your Java code style using CheckStyle. It defines a checkstyle sbt action to generate the report.

How to use

Installing

Right now the plugin is not hosted in any Maven repository (I’m new to this things, I have to get my head around publishing artifacts).

The only way to use the plugin is having it in your local repository, compiled from source:

$ git clone https://github.com/drodriguez/checkstyle4sbt
$ cd checkstyle4sbt
$ sbt "+ publish-local"

Adding checkstyle4sbt to your project

Add the following lines to your project build.sbt file:

import net.ruidoblanco.checkstyle4sbt.CheckStyle._

seq(checkstyleSettings : _*)

You also have to add the plugin dependency to your project project/plugins.sbt or the global .sbt/plugins/build.sbt:

addSbtPlugin("net.ruidoblanco" % "checkstyle4sbt" % "0.0.2")

Settings

  • checkstyleReportFormat
    • Description: Selects the output format for the CheckStyle report.
    • Accepts: ReportFormat.{Plain, Xml}
    • Default: ReportFormat.Xml
  • checkstyleTargetPath
    • Description: Output path for the CheckStyle report.
    • Accepts: any directory File
    • Default: crossTarget / "checkstyle"
  • checkstyleReportName
    • Description: Name of the report file to generate.
    • Accepts: any legal filename
    • Default: "checkstyle.xml"
  • checkstyleConfigurationFile
    • Description: Path of the CheckStyle configuration file.
    • Accepts: any directory File
    • Default: baseDirectory / "project" / "checkstyle-config.xml"
  • checkstylePropertiesFile
    • Description: Path of the CheckStyle properties file.
    • Accepts: None and Some[File]
    • Default: None (no property file)
  • checkstyleSourcePath
    • Description: Path of the CheckStyle properties file.
    • Accepts: any directory File
    • Default: javaSource

TODO

  • Publish in Sonatype

Credits & Contact

checkstyle4sbt was created by Daniel Rodríguez Troitiño. You can follow me on Twitter @yonosoytu.

checkstyle4sbt is based on the great findbugs4sbt by Joachim Hofer.

License

checkstyle4sbt is available under the MIT license. See LICENSE file for more into.