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

feat: add gha workflow and cleanup linter issues #6

Merged
merged 1 commit into from
Feb 26, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pr

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

- name: Lint
run: make lint

- name: Test
run: make test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@

# Go workspace file
go.work

# Node.js
node_modules
140 changes: 16 additions & 124 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,143 +3,31 @@ service:

run:
timeout: 5m
skip-dirs:
# DummyOIDC is copied from another repository with minor modifications.
- pkg/gateway/dummyoidc

linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- deadcode
- decorder
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- unused
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- golint
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- revive
- gosimple
- gosmopolitan
- govet
- grouper
- ifshort
- importas
- inamedparam
- ineffassign
- interfacebloat
- interfacer
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- maligned
- mirror
- misspell
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosnakecase
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- scopelint
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varcheck
- varnamelen
- wastedassign
- whitespace
- wrapcheck
# - wsl
- zerologlint
#
# - unused
# - errcheck
# - exportloopref
# - gocritic
# - gofumpt
# - goimports
# - revive
# - gosimple
# - govet
# - staticcheck
# - stylecheck
# - typecheck
# - unconvert
# - unparam
# - gosec
# - asciicheck
# - prealloc
# - predeclared
- gosec
- asciicheck
- prealloc
- predeclared
fast: false

linters-settings:
Expand All @@ -151,9 +39,13 @@ linters-settings:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
# gocritic:
# disabled-checks:
# - exitAfterDefer
exclude-functions:
- (net/http.ResponseWriter).Write
- (github.com/a-h/templ.Component).Render

gocritic:
disabled-checks:
- appendAssign
gofumpt:
# Module path which contains the source code being formatted.
module-path: github.com/verifa/horizon
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

CI_CMD := go run ./cmd/ci/*.go

.PHONY: pr
pr:
$(CI_CMD) -pr

.PHONY: lint
lint:
$(CI_CMD) -lint

.PHONY: test
test:
$(CI_CMD) -test

.PHONY: ci
ci: pr
Loading
Loading