Skip to content

Commit

Permalink
feat: add gha workflow and cleanup linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarfors committed Feb 26, 2024
1 parent c65f740 commit f6f250c
Show file tree
Hide file tree
Showing 41 changed files with 2,949 additions and 300 deletions.
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

0 comments on commit f6f250c

Please sign in to comment.