Skip to content

Commit

Permalink
ci: add revive to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
danroc committed Oct 31, 2024
1 parent 7ccb1f5 commit 6daabd2
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
go install github.com/segmentio/[email protected]
go install mvdan.cc/[email protected]
go install github.com/securego/gosec/v2/cmd/[email protected]
go install github.com/mgechev/[email protected]
- name: Build
run: make build
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'

lint: tidy ## Run linter
revive -config revive.toml -exclude vendor/... ./...
golines -m 79 --base-formatter=gofumpt .
gosec ./...
go vet ./...
Expand Down
1 change: 1 addition & 0 deletions cmd/geoblock/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main contains the main geoblock application.
package main

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/database/database.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package database provides a database of IP ranges and their associated data.
package database

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/rules/engine.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package rules contains all rules related logic.
package rules

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/schema/reader.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package schema contains configiguration schema used by geoblock.
package schema

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package server contains the HTTP authorization server.
package server

import (
Expand Down Expand Up @@ -38,6 +39,8 @@ func getForwardAuth(
resolver *database.Resolver,
engine *rules.Engine,
) {
log.Info(request.Method)

origin := request.Header.Get(HeaderXForwardedFor)
domain := request.Header.Get(HeaderXForwardedHost)

Expand Down
1 change: 1 addition & 0 deletions pkg/utils/duration.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package utils contains utility functions used by geoblock.
package utils

import (
Expand Down
29 changes: 29 additions & 0 deletions revive.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 2

[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.error-return]
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
[rule.package-comments]
[rule.range]
[rule.receiver-naming]
[rule.time-naming]
[rule.unexported-return]
[rule.indent-error-flow]
[rule.errorf]
[rule.empty-block]
[rule.superfluous-else]
[rule.unused-parameter]
[rule.unreachable-code]
[rule.redefines-builtin-id]

0 comments on commit 6daabd2

Please sign in to comment.