static_code_analysis.yml 1004 B

123456789101112131415161718192021222324252627282930313233343536
  1. name: Static code analysis
  2. on:
  3. pull_request:
  4. branches:
  5. - master
  6. jobs:
  7. scancode_job:
  8. runs-on: ubuntu-latest
  9. name: Static code analysis
  10. steps:
  11. - uses: actions/checkout@v3
  12. - name: Set up Python
  13. uses: actions/setup-python@v3
  14. with:
  15. python-version: 3.8
  16. - name: cppcheck
  17. shell: bash
  18. run: |
  19. sudo apt-get update
  20. sudo apt-get -qq install cppcheck
  21. git remote -v
  22. git fetch origin
  23. cppcheck --version
  24. ls
  25. git branch -a
  26. changed_files=$(git diff --name-only HEAD origin/master | grep -E '\.(c|cpp|cc|cxx)$' || true)
  27. if [ -n "$changed_files" ];then
  28. cppcheck --enable=warning,performance,portability --inline-suppr --error-exitcode=1 --force $changed_files
  29. err=$?
  30. if [ $err -ne 0 ]; then
  31. echo "CPPCHECK REPORT, PLEASE CHECK THE WARNING !!!!!!!!!"
  32. fi
  33. fi