forked from philips-software/amp-embedded-infra-lib
-
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.
feat: export mutation testing result to Sonar (#105)
* chore(formatting): wrap braces after union and case label * .vscode/settings.json: don't auto-add file associations * ci(sonar): use compilation database instead of build-wrapper * .github/workflows/static-analysis.yml: fix test report generation * feat: export mutation testing results to Sonar * ci: install Mull compilation driver * ci: install Mull compilation driver * CMakePresets.json: add mutation testing arguments as CMake list * fix: generate paths Sonar understands * ci(static-analysis.yml): fix access to env.GITHUB_WORKSPACE * ci: add concurrency options and fix ccache keys * ci: update gcovr to 5.2 * ci(static-analysis.yml): fix cache keys * ci: use sccache for host builds * fix(.clang-format): don't touch //NOSONAR comments * fix(protobuf): manually apply fixes from protocolbuffers/protobuf#2968 protocolbuffers/protobuf@9ba7d1c * fix(.clang-format): normalize line endings * Update .github/workflows/ci.yml Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * feat(protobuf): upgrade protobuf to v21.9 * fix: protobuf Indent() changed to two spaces * fix: Windows build; align runtime * .gitignore: exclude Visual Studio default output dir * Update CMakeLists.txt Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Thomas <56401213+thomas-philips@users.noreply.github.com>
- Loading branch information
1 parent
76f8e77
commit e7f22cd
Showing
15 changed files
with
155 additions
and
47 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> | ||
<xsl:template match="/"> | ||
<coverage version="1"> | ||
<xsl:for-each select="coverage/packages/package"> | ||
<xsl:for-each select="classes/class"> | ||
<file> | ||
<xsl:attribute name="path"> | ||
<xsl:value-of select="@filename"/> | ||
</xsl:attribute> | ||
|
||
<xsl:for-each select="lines/line"> | ||
<lineToCover> | ||
<xsl:attribute name="lineNumber"> | ||
<xsl:value-of select="@number" /> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="covered"> | ||
<xsl:choose> | ||
<xsl:when test="@hits > 0">true</xsl:when> | ||
<xsl:otherwise>false</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:attribute> | ||
</lineToCover> | ||
</xsl:for-each> | ||
</file> | ||
</xsl:for-each> | ||
</xsl:for-each> | ||
</coverage> | ||
</xsl:template> | ||
</xsl:transform> |
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,52 @@ | ||
# This jq filter transforms a mutation testing elements report to the SonarQube generic issue import format. | ||
|
||
.framework.name as $frameworkName | ||
| .projectRoot as $projectRoot | ||
| .files | ||
| to_entries | ||
| { | ||
issues: map( | ||
.value.mutants[] as $mutants | ||
| del(.value) as $file | ||
| $mutants | ||
| select(.status == ("Survived", "NoCoverage")) | ||
| ( | ||
if .replacement then | ||
"The mutation operator '" + .mutatorName + "' has mutated the input to " + .replacement + " without any tests failing." | ||
else | ||
"The mutation operator '" + .mutatorName + "' has mutated the input without any tests failing." | ||
end | ||
) as $mutation | ||
| { | ||
engineId: ($frameworkName // "Mutation Testing"), | ||
ruleId: ("Mutant" + .status), | ||
primaryLocation: { | ||
message: ( | ||
if .status == "NoCoverage" then | ||
"A mutant was not covered by any of the tests. " + $mutation | ||
else | ||
"A mutant survived after running the tests. " + $mutation | ||
end | ||
), | ||
filePath: ( | ||
if $ARGS.named["workspace"] != null then | ||
$file.key | sub("^" + $ARGS.named["workspace"] + "/"; "") | ||
elif $projectRoot then | ||
$file.key | sub("^" + $projectRoot + "/"; "") | ||
else | ||
$file.key | ||
end | ||
), | ||
textRange: { | ||
startLine: .location.start.line, | ||
endLine: .location.end.line, | ||
startColumn: (.location.start.column - 1), | ||
endColumn: (.location.end.column - 1) | ||
} | ||
}, | ||
type: "CODE_SMELL", | ||
severity: "MAJOR", | ||
effortMinutes: 10 | ||
} | ||
) | ||
} |
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
.vs | ||
Debug/ | ||
Release/ | ||
RelWithDebInfo/ | ||
megalinter-reports/ | ||
[Bb]uild* | ||
[Ii]nstall | ||
megalinter-reports/ | ||
out/ | ||
reports/ | ||
CMakeSettings.json |
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
Oops, something went wrong.