GHA: add a job to check function complexity

- Done with the new top-complexity script which uses the pmccabe tool.

- Any function scoring over 100 makes the test fail

- The script outputs all functions scoring over 70

- Two >100 functions are whitelisted by name, but they are not allowed
  to increase their scores.

Closes #17398
This commit is contained in:
Daniel Stenberg 2025-05-20 16:49:57 +02:00
parent 4a2bd8e458
commit 203b4349af
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 146 additions and 1 deletions

View file

@ -94,6 +94,26 @@ jobs:
- name: REUSE Compliance Check
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5
complexity:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
name: checkout
- name: install pmccabe
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get -o Dpkg::Use-Pty=0 update
sudo rm -f /var/lib/man-db/auto-update
sudo apt-get -o Dpkg::Use-Pty=0 install \
pmccabe
- name: check complexity scores
run: ./scripts/top-complexity
miscchecks:
runs-on: ubuntu-latest
timeout-minutes: 5