-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbf6e31
commit 3cb69c2
Showing
24 changed files
with
2,414 additions
and
61 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
merge_group: | ||
branches: ["**"] | ||
|
||
permissions: | ||
contents: read # for golangci-lint-action | ||
|
||
jobs: | ||
tests: | ||
name: Run tests | ||
strategy: | ||
matrix: | ||
os: [Ubuntu] | ||
go-version: ["1.23.x"] | ||
runs-on: ${{ matrix.os }}-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Install dependencies | ||
run: | | ||
go get ./... | ||
go install github.com/jstemmer/go-junit-report@latest | ||
- name: Build | ||
run: go build -v ./... | ||
- name: Run Tests | ||
run: go test -v ./... | go-junit-report -set-exit-code > test-report.xml | ||
- name: Test Summary | ||
uses: test-summary/action@v2 | ||
with: | ||
paths: "test-report.xml" | ||
if: always() | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.62.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
merge_group: | ||
branches: ["**"] | ||
|
||
permissions: { } | ||
|
||
jobs: | ||
build: | ||
name: Protolint | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
# To report GitHub Actions status checks | ||
statuses: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
# super-linter needs the full git history to get the | ||
# list of files that changed across commits | ||
fetch-depth: 0 | ||
|
||
- name: Lint protocol buffers | ||
uses: super-linter/super-linter@v6 | ||
env: | ||
# To report GitHub Actions status checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
LINTER_RULES_PATH: . | ||
PROTOBUF_CONFIG_FILE: .protolint.yaml | ||
VALIDATE_PROTOBUF: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json | ||
# Inspired from: (MIT license) https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322 | ||
--- | ||
run: | ||
timeout: '5m' | ||
linters-settings: | ||
errcheck: | ||
ignore: "" # https://github.com/golangci/golangci-lint/issues/4733 | ||
gosec: | ||
excludes: | ||
- G601 # Not relevant anymore with Go 1.22 and later | ||
- G404 # Use of weak random number generator (math/rand instead of crypto/rand) | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment # too strict | ||
- shadow # too strict | ||
perfsprint: | ||
strconcat: false | ||
revive: | ||
rules: | ||
- name: var-naming | ||
arguments: | ||
- [] | ||
- [] | ||
- - skipPackageNameChecks: true | ||
stylecheck: | ||
checks: ["all", "-ST1003"] | ||
linters: | ||
enable: | ||
- asasalint # checks for pass []any as any in variadic func(...any) | ||
- asciicheck # checks that your code does not contain non-ASCII identifiers | ||
- bidichk # checks for dangerous unicode character sequences | ||
- bodyclose # checks whether HTTP response body is closed successfully | ||
- canonicalheader # checks for canonical names in HTTP headers | ||
- copyloopvar # detects places where loop variables are copied | ||
#- contextcheck # checks for inherited context.Context | ||
#- cyclop # checks function and package cyclomatic complexity | ||
- dupl # tool for code clone detection | ||
- durationcheck # checks for two durations multiplied together | ||
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error | ||
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13 | ||
- exhaustive # checks exhaustiveness of enum switch statements | ||
- fatcontext # finds nested context.WithValue calls in loops | ||
- forbidigo # forbids identifiers | ||
- gocheckcompilerdirectives # validates go compiler directive comments (//go:) | ||
#- gochecknoglobals # checks that no global variables exist | ||
- gochecknoinits # checks that no init functions are present in Go code | ||
- gochecksumtype # checks exhaustiveness on Go "sum types" | ||
- goconst # finds repeated strings that could be replaced by a constant | ||
- gocritic # provides diagnostics that check for bugs, performance and style issues | ||
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt | ||
#- gomnd # detects magic numbers | ||
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod | ||
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations | ||
- goprintffuncname # checks that printf-like functions are named with f at the end | ||
- gosec # inspects source code for security problems | ||
- intrange # finds places where for loops could make use of an integer range | ||
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap) | ||
- makezero # finds slice declarations with non-zero initial length | ||
- mirror # reports wrong mirror patterns of bytes/strings usage | ||
- musttag # enforces field tags in (un)marshaled structs | ||
- nakedret # finds naked returns in functions greater than a specified function length | ||
- nilerr # finds the code that returns nil even if it checks that the error is not nil | ||
- nilnil # checks that there is no simultaneous return of nil error and an invalid value | ||
- noctx # finds sending http request without context.Context | ||
- nolintlint # reports ill-formed or insufficient nolint directives | ||
- nonamedreturns # reports all named returns | ||
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL | ||
- perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative | ||
- prealloc # finds slice declarations that could potentially be preallocated | ||
- predeclared # finds code that shadows one of Go's predeclared identifiers | ||
- promlinter # checks Prometheus metrics naming via promlint | ||
- protogetter # reports direct reads from proto message fields when getters should be used | ||
- reassign # checks that package variables are not reassigned | ||
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint | ||
- rowserrcheck # checks whether Err of rows is checked successfully | ||
- sloglint # ensure consistent code style when using log/slog | ||
- spancheck # checks for mistakes with OpenTelemetry/Census spans | ||
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed | ||
- stylecheck # is a replacement for golint | ||
- tagalign # checks that struct tags are well aligned | ||
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17 | ||
- testableexamples # checks if examples are testable (have an expected output) | ||
- testifylint # checks usage of github.com/stretchr/testify | ||
#- testpackage # makes you use a separate _test package | ||
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes | ||
- unconvert # removes unnecessary type conversions | ||
- unparam # reports unused function parameters | ||
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library | ||
- wastedassign # finds wasted assignment statements | ||
- whitespace # detects leading and trailing whitespace |
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
Oops, something went wrong.