-
Notifications
You must be signed in to change notification settings - Fork 8
chore: Add Code Static Analysis GH Workflow #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Copyright 2026 Specter Ops, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Run Code Static Analysis | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - "main" | ||
| - "stage/**" | ||
| types: | ||
| - "opened" | ||
| - "synchronize" | ||
|
|
||
| jobs: | ||
| static_analysis: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source code for this repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
| check-latest: true | ||
|
|
||
| - name: Run Analysis | ||
| continue-on-error: true | ||
| run: | | ||
| go tool golangci-lint run ./... | ||
|
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major: Remove Setting If the current codebase has many existing violations that need to be addressed gradually, consider using golangci-lint's 🔒 Proposed fix: Remove continue-on-error and optionally check only new code - name: Run Analysis
- continue-on-error: true
run: |
go tool golangci-lint run ./...
+
+# Alternative: Only check new code if fixing all existing issues is not feasible
+# - name: Run Analysis (new code only)
+# run: |
+# go tool golangci-lint run --new-from-rev=origin/${{ github.base_ref }} ./...🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||||||||||||||||
| version: "2" | ||||||||||||||||||||||
| linters: | ||||||||||||||||||||||
| disable: | ||||||||||||||||||||||
| - errcheck | ||||||||||||||||||||||
|
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Do not disable the Disabling If specific error checks need to be excluded, use targeted exclusions rather than disabling the entire linter. ✅ Proposed fix: Enable errcheck with targeted exclusions if needed-linters:
- disable:
- - errcheck
+linters:
+ enable:
+ - errcheck
+# If specific exclusions are needed:
+# linters-settings:
+# errcheck:
+# exclude-functions:
+# - fmt.Print.*📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| formatters: | ||||||||||||||||||||||
| enable: | ||||||||||||||||||||||
| - gofmt | ||||||||||||||||||||||
| - goimports | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the 🐇 here in that we would benefit from hard failing given that the static analysis is of value. We may need to tackle the current findings in order to enable merging this check into main