forked from nasa/cFS
-
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.
Fix nasa#416, Display cppcheck in Dashboard
- Loading branch information
1 parent
561b128
commit e56377e
Showing
2 changed files
with
65 additions
and
33 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 |
---|---|---|
|
@@ -41,7 +41,7 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
- name: get MISRA addon | ||
- name: Get MISRA addon | ||
run: | | ||
sudo apt-get install git -y | ||
git clone https://github.com/danmar/cppcheck.git | ||
|
@@ -52,37 +52,54 @@ jobs: | |
- name: Run bundle cppcheck | ||
if: ${{matrix.cppcheck =='bundle'}} | ||
run: | | ||
cppcheck --addon=misra --force --inline-suppr --quiet . 2> ${{matrix.cppcheck}}_cppcheck_err.txt | ||
cppcheck --addon=misra --force --inline-suppr --quiet . --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml | ||
# Run strict static analysis for embedded portions of cfe, osal, and psp | ||
- name: cfe strict cppcheck | ||
if: ${{matrix.cppcheck =='cfe'}} | ||
run: | | ||
cd ${{matrix.cppcheck}} | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./modules/core_api/fsw ./modules/core_private/fsw ./modules/es/fsw ./modules/evs/fsw ./modules/fs/fsw ./modules/msg/fsw ./modules/resourceid/fsw ./modules/sb/fsw ./modules/sbr/fsw ./modules/tbl/fsw ./modules/time/fsw -UCFE_PLATFORM_TIME_CFG_CLIENT -DCFE_PLATFORM_TIME_CFG_SERVER 2> ../${{matrix.cppcheck}}_cppcheck_err.txt | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./modules/core_api/fsw ./modules/core_private/fsw ./modules/es/fsw ./modules/evs/fsw ./modules/fs/fsw ./modules/msg/fsw ./modules/resourceid/fsw ./modules/sb/fsw ./modules/sbr/fsw ./modules/tbl/fsw ./modules/time/fsw -UCFE_PLATFORM_TIME_CFG_CLIENT -DCFE_PLATFORM_TIME_CFG_SERVER --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml | ||
- name: osal strict cppcheck | ||
if: ${{matrix.cppcheck =='osal'}} | ||
run: | | ||
cd ${{matrix.cppcheck}} | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os 2> ../${{matrix.cppcheck}}_cppcheck_err.txt | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml | ||
- name: psp strict cppcheck | ||
if: ${{matrix.cppcheck =='psp'}} | ||
run: | | ||
cd ${{matrix.cppcheck}} | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw 2> ../${{matrix.cppcheck}}_cppcheck_err.txt | ||
cppcheck --addon=misra --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./fsw --xml 2> ${{matrix.cppcheck}}_cppcheck_err.xml | ||
- name: Convert bundle cppcheck to sarif | ||
uses: airtower-luna/[email protected] | ||
if: ${{matrix.cppcheck =='bundle'}} | ||
with: | ||
tool: 'CppCheck' | ||
input_file: '${{matrix.cppcheck}}_cppcheck_err.xml' | ||
sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' | ||
|
||
- name: Archive Static Analysis Artifacts | ||
- name: Convert cfe, osal, psp cppcheck to sarif | ||
uses: airtower-luna/[email protected] | ||
with: | ||
tool: 'CppCheck' | ||
input_file: '${{matrix.cppcheck}}/${{matrix.cppcheck}}_cppcheck_err.xml' | ||
sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' | ||
|
||
- name: Define workspace | ||
run: | | ||
echo "CONTAINER_WORKSPACE=${PWD}" >> ${GITHUB_ENV} | ||
- name: Upload sarif results | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: '${{matrix.cppcheck}}_cppcheck_err.sarif' | ||
checkout_path: ${{ env.CONTAINER_WORKSPACE }} | ||
|
||
- name: Archive static analysis artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{matrix.cppcheck}}-cppcheck-err | ||
path: ./*cppcheck_err.txt | ||
|
||
- name: Check for errors | ||
run: | | ||
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]]; | ||
then | ||
cat ${{matrix.cppcheck}}_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
path: ./*cppcheck_err.xml |
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 |
---|---|---|
|
@@ -44,32 +44,47 @@ jobs: | |
submodules: true | ||
|
||
- name: Run general cppcheck | ||
run: cppcheck --force --inline-suppr . 2> general_cppcheck_err.txt | ||
run: cppcheck --force --inline-suppr . --xml 2> general_cppcheck_err.xml | ||
|
||
- name: Convert general cppcheck | ||
uses: airtower-luna/[email protected] | ||
with: | ||
tool: 'CppCheck' | ||
input_file: 'general_cppcheck_err.xml' | ||
sarif_file: 'general_cppcheck_err.sarif' | ||
|
||
- name: Check for general errors | ||
- name: Define workspace | ||
run: | | ||
if [[ -s general_cppcheck_err.txt ]]; | ||
then | ||
cat general_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
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 }} 2> strict_cppcheck_err.txt | ||
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 | ||
|
||
- name: Check for strict errors | ||
- name: Convert strict cppcheck | ||
uses: airtower-luna/[email protected] | ||
if: ${{ inputs.strict-dir-list !='' }} | ||
run: | | ||
if [[ -s strict_cppcheck_err.txt ]]; | ||
then | ||
cat strict_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
with: | ||
tool: 'CppCheck' | ||
input_file: 'strict_cppcheck_err.xml' | ||
sarif_file: 'strict_cppcheck_err.sarif' | ||
|
||
- 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: Archive Static Analysis Artifacts | ||
- name: Archive static analysis artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cppcheck-errors | ||
path: ./*cppcheck_err.txt | ||
path: ./*cppcheck_err.xml |