Skip to content

Commit

Permalink
feat(workflow): add complexity check for Go codebase
Browse files Browse the repository at this point in the history
This commit introduces a new GitHub Actions workflow to automatically
check the complexity of Go functions using gocyclo. The workflow
triggers on pushes and pull requests to the main branch. It ensures
that any function exceeding a complexity threshold of 20 is flagged,
helping maintain code quality and readability.
  • Loading branch information
YidiDev committed Oct 10, 2024
1 parent 79a9e4f commit 98adf1f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/complecity-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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."

0 comments on commit 98adf1f

Please sign in to comment.