Skip to content

Error on use of multiple variants of the same component for the same context (#960) #257

Error on use of multiple variants of the same component for the same context (#960)

Error on use of multiple variants of the same component for the same context (#960) #257

Workflow file for this run

name: cpp-linter
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/cpp-linter.yml'
- '.github/.cppcheck_suppressions'
- '.github/cppcheck_googletest.cfg'
- '**/*.cpp'
- '**/*.h'
- '**/*.hpp'
- '**/*.in'
- '**/CMakeLists.txt'
- '!**/docs/**/*'
- '!**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
linter_report: "cppcheck_report.md"
jobs:
lint:
name: cppcheck
runs-on: ubuntu-22.04
steps:
- name: Checkout devtools
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cppcheck
- name: Run cppcheck
run: |
cppcheck --enable=performance,portability,unusedFunction,warning \
--library=.github/cppcheck_googletest.cfg --suppressions-list=.github/.cppcheck_suppressions \
--force -i./external --language=c++ --max-ctu-depth=20 \
--platform=unix64 --std=c++17 --verbose --std=c++17 \
-i./tools/buildmgr/test -i./tools/packchk/test \
-i./tools/packgen/test -i./tools/projmgr/test \
-i./tools/svdconv/Test -i./test \
--template="|{file}|{line}|{severity}|{message}|" \
--output-file=./${{ env.linter_report }} .
- name: Check errors
run: |
echo "value=$(test ! -s ${{ env.linter_report}} &>/dev/null ; echo $?)" >> $GITHUB_OUTPUT
id: errors
- name: Append report
if: ${{ steps.errors.outputs.value == '1' }}
run: |
echo -e -n "## :boom: [Linter Results](https://cppcheck.sourceforge.io/)\\n|File|Line|Severity|Message|\n|:--|:--|:--|--|\n" | cat - ./${{ env.linter_report }} > ./tmpfile
mv ./tmpfile ./${{ env.linter_report }}
- name: Archive Cppcheck results
if: ${{ steps.errors.outputs.value == '1' }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: cppcheck-report
path: ./${{ env.linter_report }}
retention-days: 1
if-no-files-found: error
- name: Print Linter Summary
if: ${{ steps.errors.outputs.value == '1' }}
run: cat ${{ env.linter_report }} >> $GITHUB_STEP_SUMMARY
- name: Validate results
run: |
if [ "${{ steps.errors.outputs.value}}" = "1" ]; then
echo "💥 Issue(s) detected. Check summary: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
exit 1
else
echo "👍 No issues detected."
fi