forked from etsy/sbt-checkstyle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fdaab5
commit da48268
Showing
7 changed files
with
106 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,34 +14,36 @@ import java.util.Properties | |
import javax.xml.transform.stream.StreamSource | ||
import scala.collection.JavaConverters.* | ||
|
||
/** A Scala wrapper around the Checkstyle Java API | ||
* | ||
* @author | ||
* Andrew Johnson <[email protected]> | ||
* @author | ||
* Joseph Earl <[email protected]> | ||
*/ | ||
/** | ||
* A Scala wrapper around the Checkstyle Java API | ||
* | ||
* @author | ||
* Andrew Johnson <[email protected]> | ||
* @author | ||
* Joseph Earl <[email protected]> | ||
*/ | ||
object Checkstyle { | ||
|
||
/** Runs Checkstyle. | ||
* | ||
* Note: any non-Java sources passed to this function will be ignored. | ||
* | ||
* @param sourceFiles | ||
* list of source files to scan. | ||
* @param configLocation | ||
* location of the Checkstyle config to use. | ||
* @param resources | ||
* list of resource files (used if `configLocation` points to the classpath). | ||
* @param outputFile | ||
* file to store the Checkstyle report in. | ||
* @param xsltTransformations | ||
* XML transformations to apply to the Checkstyle report. | ||
* @param severityLevel | ||
* threshold of violations for failing the build if reached. | ||
* @param log | ||
* used to log status of Checkstyle. | ||
*/ | ||
/** | ||
* Runs Checkstyle. | ||
* | ||
* Note: any non-Java sources passed to this function will be ignored. | ||
* | ||
* @param sourceFiles | ||
* list of source files to scan. | ||
* @param configLocation | ||
* location of the Checkstyle config to use. | ||
* @param resources | ||
* list of resource files (used if `configLocation` points to the classpath). | ||
* @param outputFile | ||
* file to store the Checkstyle report in. | ||
* @param xsltTransformations | ||
* XML transformations to apply to the Checkstyle report. | ||
* @param severityLevel | ||
* threshold of violations for failing the build if reached. | ||
* @param log | ||
* used to log status of Checkstyle. | ||
*/ | ||
def checkstyle( | ||
sourceFiles: Seq[File], | ||
configLocation: CheckstyleConfigLocation, | ||
|
@@ -99,13 +101,14 @@ object Checkstyle { | |
) | ||
} | ||
|
||
/** Applies a set of XSLT transformation to the XML file produced by checkstyle | ||
* | ||
* @param input | ||
* The XML file produced by checkstyle | ||
* @param transformations | ||
* The XSLT transformations to be applied | ||
*/ | ||
/** | ||
* Applies a set of XSLT transformation to the XML file produced by checkstyle | ||
* | ||
* @param input | ||
* The XML file produced by checkstyle | ||
* @param transformations | ||
* The XSLT transformations to be applied | ||
*/ | ||
private def applyXSLT( | ||
input: File, | ||
transformations: Set[CheckstyleXSLTSettings] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,16 @@ import sbt.* | |
import sbt.Def.Initialize | ||
import sbt.Keys.* | ||
|
||
/** An SBT plugin to run checkstyle over Java code | ||
* | ||
* @author | ||
* Andrew Johnson <[email protected]> | ||
* @author | ||
* Alejandro Rivera <[email protected]> | ||
* @author | ||
* Joseph Earl <[email protected]> | ||
*/ | ||
/** | ||
* An SBT plugin to run checkstyle over Java code | ||
* | ||
* @author | ||
* Andrew Johnson <[email protected]> | ||
* @author | ||
* Alejandro Rivera <[email protected]> | ||
* @author | ||
* Joseph Earl <[email protected]> | ||
*/ | ||
object CheckstylePlugin extends AutoPlugin { | ||
override def trigger: PluginTrigger = allRequirements | ||
|
||
|
@@ -39,11 +40,12 @@ object CheckstylePlugin extends AutoPlugin { | |
val CheckstyleXSLTSettings: com.etsy.sbt.checkstyle.CheckstyleXSLTSettings.type = | ||
com.etsy.sbt.checkstyle.CheckstyleXSLTSettings | ||
|
||
/** Runs checkstyle | ||
* | ||
* @param conf | ||
* The configuration (Compile or Test) in which context to execute the checkstyle command | ||
*/ | ||
/** | ||
* Runs checkstyle | ||
* | ||
* @param conf | ||
* The configuration (Compile or Test) in which context to execute the checkstyle command | ||
*/ | ||
def checkstyleTask(conf: Configuration): Initialize[Task[Unit]] = Def.task { | ||
Checkstyle.checkstyle( | ||
(conf / sources).value, | ||
|
11 changes: 6 additions & 5 deletions
11
src/main/scala/com/etsy/sbt/checkstyle/CheckstyleSeverityLevel.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters