-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Colin Kennedy <[email protected]>
- Loading branch information
Showing
23 changed files
with
369 additions
and
392 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,27 @@ | ||
name: lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
name: golangci | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.57.2 |
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,28 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: coverage profile | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: [ '1.22' ] | ||
os: [ ubuntu-latest, macos-latest, self-hosted-linux-arm64] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: generate test coverage | ||
run: make install-go-test-coverage && make cover.out | ||
- name: check test coverage | ||
uses: vladopajic/go-test-coverage@v2 | ||
with: | ||
config: .testcoverage.yml |
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,130 @@ | ||
linters-settings: | ||
depguard: | ||
rules: | ||
logger: | ||
deny: | ||
- pkg: github.com/sirupsen/logrus | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- sloppyReassign | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
- unnamedResult | ||
goimports: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
gomnd: | ||
# don't include the "operation" and "assign" | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- return | ||
ignored-numbers: | ||
- '0' | ||
- '1' | ||
- '2' | ||
- '3' | ||
ignored-functions: | ||
- strings.SplitN | ||
|
||
govet: | ||
shadow: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 140 | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gofumpt | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
- tparallel | ||
- gci | ||
|
||
# don't enable: | ||
# - asciicheck | ||
# - funlen | ||
# - gocyclo | ||
# - scopelint | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - interfacer | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - testpackage | ||
# - revive | ||
# - wsl | ||
|
||
issues: | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gomnd | ||
- funlen | ||
- lll | ||
- gosec | ||
|
||
- linters: | ||
- lll | ||
source: "^//go:generate " | ||
exclude-dirs: | ||
- app # This code is left over and will be changed soon. | ||
|
||
run: | ||
timeout: 5m |
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,12 @@ | ||
profile: cover.out | ||
local-prefix: github.com/polymerdao/monomer | ||
threshold: | ||
package: 65 | ||
total: 70 | ||
exclude: | ||
paths: | ||
- \.pb\.go$ | ||
- ^app | ||
- ^x/rollup | ||
- ^cmd/monomer | ||
- ^engine |
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 |
---|---|---|
@@ -1,7 +1,37 @@ | ||
.PHONY: monomer | ||
monomer: | ||
@go build -o monomer ./cmd/monomer/ | ||
GOBIN ?= $$(go env GOPATH)/bin | ||
BINARY_NAME ?= monomer | ||
COVER_OUT ?= cover.out | ||
COVER_HTML ?= cover.html | ||
|
||
.PHONY: $(BINARY_NAME) | ||
$(BINARY_NAME): | ||
go build -o $(BINARY_NAME) ./cmd/monomer/ | ||
|
||
.PHONY: install-golangci-lint | ||
install-golangci-lint: | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
.PHONY: lint | ||
lint: install-golangci-lint | ||
${GOBIN}/golangci-lint run | ||
|
||
.PHONY: install-go-test-coverage | ||
install-go-test-coverage: | ||
go install github.com/vladopajic/go-test-coverage/[email protected] | ||
|
||
$(COVER_OUT): | ||
go test ./... -coverprofile=$@ -covermode=atomic -coverpkg=./... | ||
${GOBIN}/go-test-coverage --config=./.testcoverage.yml | ||
|
||
$(COVER_HTML): $(COVER_OUT) | ||
go tool cover -html=$< -o $@ | ||
|
||
.PHONY: test | ||
test: | ||
go test ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
@if [ -f ./monomer ]; then rm ./monomer; fi | ||
if [ -f $(BINARY_NAME) ]; then rm $(BINARY_NAME); fi | ||
if [ -f $(COVER_OUT) ]; then rm $(COVER_OUT); fi | ||
if [ -f $(COVER_HTML) ]; then rm $(COVER_HTML); fi |
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
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
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
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.