-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show evaluation metrics in submissions overview [WIP]
- Loading branch information
Showing
14 changed files
with
152 additions
and
97 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
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/de/code_freak/codefreak/frontend/EvaluationViewModel.kt
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package de.code_freak.codefreak.frontend | ||
|
||
import de.code_freak.codefreak.entity.Evaluation | ||
import de.code_freak.codefreak.service.evaluation.EvaluationService | ||
import org.slf4j.LoggerFactory | ||
import java.util.UUID | ||
|
||
data class EvaluationViewModel(val evaluation: Evaluation, | ||
val resultContents: Map<UUID, Any>, | ||
val resultTemplates: Map<UUID, String>) { | ||
|
||
companion object { | ||
private val log = LoggerFactory.getLogger(this::class.java) | ||
fun create(evaluation: Evaluation, evaluationService: EvaluationService): EvaluationViewModel { | ||
val resultTemplates = mutableMapOf<UUID, String>() | ||
val resultContents = mutableMapOf<UUID, Any>() | ||
evaluation.results.forEach { | ||
if (it.error) { | ||
resultContents[it.id] = String(it.content) | ||
resultTemplates[it.id] = "error" | ||
} else { | ||
try { | ||
resultContents[it.id] = evaluationService.getEvaluationRunner(it.runnerName).parseResultContent(it.content) | ||
resultTemplates[it.id] = it.runnerName | ||
} catch (e: Exception) { | ||
log.error(e.message) | ||
resultContents[it.id] = "Error while displaying result" | ||
resultTemplates[it.id] = "error" | ||
} | ||
} | ||
} | ||
return EvaluationViewModel(evaluation, resultContents, resultTemplates) | ||
} | ||
} | ||
} |
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
7 changes: 0 additions & 7 deletions
7
src/main/kotlin/de/code_freak/codefreak/service/evaluation/ResultType.kt
This file was deleted.
Oops, something went wrong.
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
42 changes: 42 additions & 0 deletions
42
src/main/resources/templates/evaluation-summary/codeclimate.html
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<span | ||
th:with="numIssues=${#lists.size(content.issues)}" | ||
th:title="|Error determining result of ${result.runnerName} runner|" data-toggle="tooltip"> | ||
<th:block th:text="${numIssues}"></th:block> | ||
</span> | ||
<h3 class="card-title">Code Quality</h3> | ||
<div class="alert alert-success lead" th:if="${#lists.size(content.issues) == 0}"> | ||
<i class="far fa-check-circle text-success"></i> No code-quality issues detected! | ||
</div> | ||
<th:block th:each="issue : ${content.issues}"> | ||
<h4 class="mt-3" th:text="${issue.description}"></h4> | ||
<p> | ||
Severity: | ||
<th:block th:switch="${issue.severity}"> | ||
<span th:case="'info'" class="badge badge-info">Info</span> | ||
<span th:case="'minor'" class="badge badge-secondary">Minor</span> | ||
<span th:case="'major'" class="badge badge-warning">Major</span> | ||
<span th:case="'critical'" class="badge badge-danger">Critical</span> | ||
<span th:case="'blocker'" class="badge badge-danger">Blocker</span> | ||
</th:block> | ||
Categories: | ||
<th:block th:each="category : ${issue.categories}"> | ||
<span th:text="${category}" class="badge badge-secondary"></span> | ||
</th:block> | ||
<span class="text-muted">by <span th:text="${issue.engine_name}"></span></span> | ||
<br> | ||
File: <code th:utext="${issue.location.path}"></code> at line | ||
<span th:text="${issue.location.lines.begin}"></span> | ||
<span th:if="${issue.location.lines.begin != issue.location.lines.end}" th:text="${'-' + issue.location.lines.end}"></span> | ||
</p> | ||
<th:block th:if="${issue.content}" th:with="id=${'details-'+T(java.util.UUID).randomUUID()}"> | ||
<button class="btn btn-light" type="button" data-toggle="collapse" th:attr="data-target=${'#' + id}">Show more information</button> | ||
<div class="collapse mt-3" th:id="${id}"> | ||
<div class="card card-body" th:utext="${@markdown.html(issue.content.body)}"></div> | ||
</div> | ||
</th:block> | ||
</th:block> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
src/main/resources/templates/evaluation-summary/commandline.html
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<h3 class="card-title">Command Line</h3> | ||
<div class="mb-3" th:each="execution : ${content}"> | ||
<h4> | ||
<th:block th:switch="${execution.result.exitCode}"> | ||
<span th:case="0" class="badge badge-success">Success</span> | ||
<span th:case="-1" class="badge badge-info">Skipped</span> | ||
<span th:case="*" class="badge badge-danger">Failure</span> | ||
</th:block> | ||
<code th:text="${execution.command}"></code> | ||
</h4> | ||
<pre th:text="${execution.result.output}"></pre> | ||
</div> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<i class="fas fa-exclamation-circle text-danger" th:title="|Error determining result of ${result.runnerName} runner|" data-toggle="tooltip"></i> | ||
</body> | ||
</html> |
34 changes: 34 additions & 0 deletions
34
src/main/resources/templates/evaluation-summary/junit.html
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<h3 class="card-title">Unit Tests</h3> | ||
<th:block th:with="error = ${content.executions.?[result.exitCode == -1].size() > 0}"> | ||
<span th:unless="${error}" th:with="" th:each="testSuite : ${content.testSuites}" title="Unit tests could not be executed" data-toggle="tooltip"> | ||
<h4> | ||
<span th:text="${testSuite.name}"></span> | ||
<span th:text="${testSuite.tests - testSuite.skipped - testSuite.failures - testSuite.errors} + ' Passed'" class="badge badge-success"></span> | ||
<span th:if="${testSuite.failures > 0}" th:text="${testSuite.failures} + ' Failed'" class="badge badge-danger"></span> | ||
<span th:if="${testSuite.errors > 0}" th:text="${testSuite.errors} + ' Errored'" class="badge badge-danger"></span> | ||
<span th:if="${testSuite.skipped > 0}" th:text="${testSuite.skipped} + ' Skipped'" class="badge badge-info"></span> | ||
</h4> | ||
<ul class="list-group"> | ||
<li class="list-group-item" th:each="testCase : ${testSuite.testCases}"> | ||
<th:block th:switch="true"> | ||
<i th:case="${testCase.skipped != null}" class="fas fa-forward text-info"></i> | ||
<i th:case="${testCase.errors != null}" class="fas fa-exclamation-circle text-danger"></i> | ||
<i th:case="${testCase.failures != null}" class="fas fa-times-circle text-danger"></i> | ||
<i th:case="*" class="far fa-check-circle text-success"></i> | ||
</th:block> | ||
<span th:text="${testCase.name}"></span> | ||
<pre class="alert alert-danger mt-2 mb-1" th:each="failure : ${testCase.failures}" | ||
th:text="${failure.message.startsWith(failure.type+': ') ? #strings.substring(failure.message, failure.type.length()+2) : failure.message}"> | ||
</pre> | ||
</li> | ||
</ul> | ||
</span> | ||
<span th:if="${error}" title="Unit tests could not be executed" data-toggle="tooltip"> | ||
N/A <i class="fas fa-times-circle text-danger"></i> | ||
</span> | ||
</th:block> | ||
</body> | ||
</html> |
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