Merge pull request #14 from go-advanced-admin/complexity #2
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
name: Complexity Check | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
complexity: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
- name: Install gocyclo | |
run: go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | |
- name: Run gocyclo | |
run: gocyclo -over 20 . || exit 1 | |
- name: Fail on high complexity | |
if: failure() | |
run: echo "One or more functions exceed the permissible complexity threshold of 20." |