-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #416, Display cppcheck in Code Scanning Alerts Dashboard #514
Merged
dzbaker
merged 1 commit into
nasa:main
from
ArielSAdams:fix-416-display-cppcheck-dashboard
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -43,22 +43,63 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
- name: Run general cppcheck | ||
run: cppcheck --force --inline-suppr . 2> general_cppcheck_err.txt | ||
- name: Run general cppcheck | ||
run: | | ||
cppcheck --force --inline-suppr . --xml 2> general_cppcheck_err.xml | ||
cppcheck --force --inline-suppr . 2> general_cppcheck_err.txt | ||
|
||
- name: Convert general cppcheck | ||
uses: airtower-luna/convert-to-sarif@v0.2.0 | ||
with: | ||
tool: 'CppCheck' | ||
input_file: 'general_cppcheck_err.xml' | ||
sarif_file: 'general_cppcheck_err.sarif' | ||
|
||
- name: Define workspace | ||
run: | | ||
echo "CONTAINER_WORKSPACE=${PWD}" >> ${GITHUB_ENV} | ||
|
||
- name: Upload general SARIF results | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'general_cppcheck_err.sarif' | ||
checkout_path: ${{ env.CONTAINER_WORKSPACE }} | ||
|
||
# Run strict static analysis for embedded portions of cfe, osal, and psp | ||
- name: Strict cppcheck | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
run: | | ||
cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ${{ inputs.strict-dir-list }} --xml 2> strict_cppcheck_err.xml | ||
cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ${{ inputs.strict-dir-list }} 2> strict_cppcheck_err.txt | ||
|
||
- name: Convert strict cppcheck | ||
uses: airtower-luna/convert-to-sarif@v0.2.0 | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
with: | ||
tool: 'CppCheck' | ||
input_file: 'strict_cppcheck_err.xml' | ||
sarif_file: 'strict_cppcheck_err.sarif' | ||
|
||
- name: Archive static analysis artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cppcheck-errors | ||
path: ./*cppcheck_err.* | ||
|
||
- name: Upload strict SARIF results | ||
uses: github/codeql-action/upload-sarif@v2 | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
with: | ||
sarif_file: 'strict_cppcheck_err.sarif' | ||
checkout_path: ${{ env.CONTAINER_WORKSPACE }} | ||
|
||
- name: Check for general errors | ||
run: | | ||
if [[ -s general_cppcheck_err.txt ]]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this check with the xml file instead to alert users when cppcheck flags errors. |
||
then | ||
cat general_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
|
||
# Run strict static analysis for embedded portions of cfe, osal, and psp | ||
- name: Strict cppcheck | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
run: cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ${{ inputs.strict-dir-list }} 2> strict_cppcheck_err.txt | ||
|
||
- name: Check for strict errors | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
run: | | ||
|
@@ -67,9 +108,3 @@ jobs: | |
cat strict_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
|
||
- name: Archive Static Analysis Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cppcheck-errors | ||
path: ./*cppcheck_err.txt |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth keeping this to flag errors at the end of the workflow run