-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #607, rework static-analysis workflow
Updates the static analysis workflow: - Make it work with the latest Ubuntu and Cppcheck - Allow callers to pass in a project configuration to get "real" macro definitions and include paths - Streamlined - only generate XML outputs, then use XSLT to convert that to text, rather than running the tool twice. - Streamlined - merge the two XML outputs into one, before converting to sarif and uploading - Streamlined - Call the sarif conversion tool directly, rather than going through a 3rd party action.
- Loading branch information
Showing
4 changed files
with
115 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||
<xsl:output method="xml" encoding="UTF-8"/> | ||
<xsl:variable name="merge_items" select="document($merge_file)/results/errors/error" /> | ||
|
||
<!-- A default template that makes an XML output identical to the input --> | ||
<xsl:template match="@* | node()"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@* | node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<!-- | ||
A specific template for the "errors" element, which includes: | ||
all the "error" child elements from this element | ||
all the "error" elements from the merged document | ||
--> | ||
<xsl:template match="results/errors"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="error" /> | ||
<xsl:apply-templates select="$merge_items" /> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
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 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||
<xsl:output method="text" encoding="UTF-8"/> | ||
<xsl:template match="/">## CppCheck <xsl:value-of select="//cppcheck/@version"/> Summary | ||
<xsl:if test="count(//error) > 0"> | ||
| error | warning | style | performance | portability | information | | ||
| --- | --- | --- | --- | --- | --- | | ||
| <xsl:value-of select="count(//error[@severity='error'])"/> | <xsl:value-of select="count(//error[@severity='warning'])"/> | <xsl:value-of select="count(//error[@severity='style'])"/> | <xsl:value-of select="count(//error[@severity='performance'])"/> | <xsl:value-of select="count(//error[@severity='portability'])"/> | <xsl:value-of select="count(//error[@severity='information'])"/> | | ||
|
||
| severity | file | line | issue | | ||
| --- | --- | --- | --- | | ||
<xsl:for-each select="results//error">| <xsl:value-of select="@severity"/> | <xsl:value-of select="location/@file"/> | <xsl:value-of select="location/@line"/> | <xsl:value-of select="@msg"/> | | ||
</xsl:for-each> | ||
</xsl:if> | ||
**<xsl:value-of select="count(//error)"/> error(s) reported** | ||
</xsl:template> | ||
</xsl:stylesheet> |
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,10 +1,9 @@ | ||
name: Reuse Static Analysis | ||
name: Bundle Static Analysis | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
static-analysis: | ||
name: Static Analysis | ||
uses: nasa/cFS/.github/workflows/static-analysis.yml@main | ||
uses: nasa/cFS/.github/workflows/static-analysis.yml@main |
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