Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import org.gradle.jvm.tasks.Jar

plugins {
java
jacoco
pmd
checkstyle
}

group = "org.eolang"
Expand Down Expand Up @@ -48,6 +51,21 @@ val fatJar = task("fatJar", type = Jar::class) {
}

tasks {
"pmdMain" {
dependsOn(classes)
}
"checkstyleMain" {
dependsOn(classes)
}
"pmdTest" {
dependsOn(testClasses)
}
"checkstyleTest" {
dependsOn(testClasses)
}
"jacocoTestReport" {
dependsOn(test)
}
"build" {
dependsOn(fatJar)
}
Expand Down Expand Up @@ -76,6 +94,55 @@ tasks.getByName("build") {
tasks.getByName<Test>("test") {
useJUnitPlatform()
systemProperty("candidates", System.getProperty("candidates"))
finalizedBy(tasks.getByName("jacocoTestReport"))
}

pmd {
isIgnoreFailures = true
isConsoleOutput = false
toolVersion = "6.40.0"
rulesMinimumPriority.set(5)
}


checkstyle {
toolVersion = "9.1"
isShowViolations = false
isIgnoreFailures = true
}

tasks.withType<Checkstyle>().configureEach {
reports {
xml.required.set(false)
html.required.set(true)
html.stylesheet = resources.text.fromFile("config/xsl/checkstyle-simple.xsl")
}
}
tasks.withType<JacocoCoverageVerification> {
/*violationRules {
rule {
limit {
minimum = BigDecimal(0.62)
}
}
}*/

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it).apply {
exclude("parser/**")
}
}))
}
}
tasks.withType<JacocoReport> {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it).apply {
exclude("parser/**")
}
}))
}
}

/**
Expand Down
361 changes: 361 additions & 0 deletions config/checkstyle/checkstyle.xml

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions config/xsl/checkstyle-simple.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head>
<title>Sun Coding Style Violations</title>
</head>
<body bgcolor="#FFFFEF">
<p><b>Coding Style Check Results</b></p>
<table border="1" cellspacing="0" cellpadding="2">
<tr bgcolor="#CC9966">
<th colspan="2"><b>Summary</b></th>
</tr>
<tr bgcolor="#CCF3D0">
<td>Total files checked</td>
<td><xsl:number level="any" value="count(descendant::file)"/></td>
</tr>
<tr bgcolor="#F3F3E1">
<td>Files with errors</td>
<td><xsl:number level="any" value="count(descendant::file[error])"/></td>
</tr>
<tr bgcolor="#CCF3D0">
<td>Total errors</td>
<td><xsl:number level="any" value="count(descendant::error)"/></td>
</tr>
<tr bgcolor="#F3F3E1">
<td>Errors per file</td>
<td><xsl:number level="any" value="count(descendant::error) div count(descendant::file)"/></td>
</tr>
</table>
<hr align="left" width="95%" size="1"/>
<p>The following are violations of the Sun Coding-Style Standards:</p>
<p/>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="file[error]">
<table bgcolor="#AFFFFF" width="95%" border="1" cellspacing="0" cellpadding="2">
<tr>
<th> File: </th>
<td>
<xsl:value-of select="@name"/>
</td>
</tr>
</table>
<table bgcolor="#DFFFFF" width="95%" border="1" cellspacing="0" cellpadding="2">
<tr>
<th> Line Number </th>
<th> Error Message </th>
</tr>
<xsl:apply-templates select="error"/>
</table>
<p/>
</xsl:template>

<xsl:template match="error">
<tr>
<td>
<xsl:value-of select="@line"/>
</td>
<td>
<xsl:value-of select="@message"/>
</td>
</tr>
</xsl:template>

</xsl:stylesheet>
Loading