Skip to content
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

Add github actions to lint #241

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### What happened?

### What did you expect?

### Minimal graphql.schema and models to reproduce

### versions
- `go list -m github.com/vektah/gqlparser/v2`?
- `go version`?

<!--
Please make sure you are using github.com/vektah/gqlparser/v2 as the v1 is no longer supported!
-->

5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Describe your PR and link to any relevant issues.

I have:
- [ ] Added tests covering the bug / feature
- [ ] Updated any relevant documentation
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
GOFLAGS: "-trimpath"
GO_VERSION: 1.19
jobs:
resolve-modules:
name: Resolve Modules
# runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- id: set-matrix
run: ./tools/resolve-modules.sh
golangci:
name: Linter
needs: resolve-modules
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
# stable: 'false' # Keep this line to be able to use rc and beta version of Go (ex: 1.18.0-rc1).
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v3.2.0
with:
version: latest
# skip cache because of flaky behaviors
skip-build-cache: true
skip-pkg-cache: true
working-directory: ${{ matrix.workdir }}
args: --timeout 5m --issues-exit-code=0
# only-new-issues: true #show only new issues if it's a pull request. options working-directory and only-new-issues are incompatible
45 changes: 45 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
run:
timeout: 10m
linters:
disable-all: true
enable:
- ineffassign
- typecheck
- varcheck
- unused
- structcheck
- deadcode
- gosimple
- goimports
- errcheck
- staticcheck
- stylecheck
- gosec
- asciicheck
- bodyclose
- exportloopref
- rowserrcheck
- makezero
- durationcheck
- prealloc
- predeclared

linters-settings:
staticcheck:
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
stylecheck:
checks: ["-ST1003"]
gosec:
severity: "low"
confidence: "low"
excludes:
- G101
- G112
issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
- gosec
- rowserrcheck
- makezero