File: cppcheck.yml

package info (click to toggle)
opentelemetry-cpp 1.23.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,368 kB
  • sloc: cpp: 96,239; sh: 1,766; makefile: 38; python: 31
file content (71 lines) | stat: -rw-r--r-- 2,125 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: cppcheck

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read

jobs:
  cppcheck:
    runs-on: ubuntu-24.04
    steps:
      - name: Harden the runner (Audit all outbound calls)
        uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
        with:
          egress-policy: audit

      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          submodules: 'recursive'

      - name: Set up dependencies
        run: |
          sudo apt update -y
          sudo apt install -y cppcheck

      - name: Run cppcheck
        run: |
          cppcheck --version | tee cppcheck.log
          cppcheck \
            --force \
            --enable=warning,performance,portability \
            --inline-suppr \
            --suppress=unknownMacro:exporters/etw/include/opentelemetry/exporters/etw/TraceLoggingDynamic.h \
            --language=c++ \
            --std=c++14 \
            -I api/include \
            -I exporters/elasticsearch/include \
            -I exporters/etw/include \
            -I exporters/memory/include \
            -I exporters/ostream/include \
            -I exporters/otlp/include \
            -I exporters/prometheus/include \
            -I exporters/zipkin/include \
            -I ext/include \
            -I opentracing-shim/include \
            -I sdk/include \
            -i build \
            -i test \
            -i third_party \
            -j $(nproc) \
            . 2>&1 | tee --append cppcheck.log

      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        if: success() || failure()
        with:
          name: Logs (cppcheck)
          path: ./cppcheck.log

      - name: Count warnings
        run: |
          set +e
          readonly WARNING_COUNT=`grep -c -E "\[.+\]" cppcheck.log`
          echo "cppcheck reported ${WARNING_COUNT} warning(s)"
          if [ $WARNING_COUNT -gt 0 ] ; then
            echo "::warning::cppcheck reported ${WARNING_COUNT} warning(s)"
            exit 1
          fi