-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/tx-client' into refactor/keyring-errors-helpers
* feat/tx-client: chore: fix import paths post-update chore: refactor & condense godoc comments chore: update go.mod chore: revise (and move to godoc.go) `testblock` & `testeventsquery` pkg godoc comment [Tooling] add `go_lint` & `go_imports` make targets & CI step (#129) Update README.md [Code Health] Support `godoc` by replacing the `pocket `module name with `github.com/pokt-network/poktroll` (#128)
- Loading branch information
Showing
296 changed files
with
1,346 additions
and
1,963 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
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,56 @@ | ||
linters-settings: | ||
govet: | ||
check-shadowing: true | ||
|
||
# TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. | ||
# Don't forget to delete the `disable-all: true` line as well. | ||
linters: | ||
disable-all: true | ||
enable: | ||
# - govet | ||
# - revive | ||
# - errcheck | ||
# - unused | ||
- goimports | ||
|
||
issues: | ||
exclude-use-default: true | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
# TODO_CONSIDERATION/TODO_TECHDEBT: Perhaps we should prefer enforcing the best | ||
# practices suggested by the linters over convention or the default in generated | ||
# code (where possible). The more exceptions we have, the bigger the gaps will be | ||
# in our linting coverage. We could eliminate or reduce these exceptions step- | ||
# by-step. | ||
exclude-rules: | ||
# Exclude cosmos-sdk module genesis.go files as they are generated with an | ||
# empty import block containing a comment used by ignite CLI. | ||
- path: ^x/.+/genesis\.go$ | ||
linters: | ||
- goimports | ||
# Exclude cosmos-sdk module module.go files as they are generated with unused | ||
# parameters and unchecked errors. | ||
- path: ^x/.+/module\.go$ | ||
linters: | ||
- revive | ||
- errcheck | ||
# Exclude cosmos-sdk module tx.go files as they are generated with unused | ||
# constants. | ||
- path: ^x/.+/cli/tx\.go$ | ||
linters: | ||
- unused | ||
# Exclude simulation code as it's generated with lots of unused parameters. | ||
- path: .*/simulation/.*|_simulation\.go$ | ||
linters: | ||
- revive | ||
# Exclude cosmos-sdk module codec files as they are scaffolded with a unused | ||
# paramerters and a comment used by ignite CLI. | ||
- path: ^x/.+/codec.go$ | ||
linters: | ||
- revive | ||
- path: _test\.go$ | ||
linters: | ||
- errcheck | ||
# TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration | ||
#new: true, | ||
#fix: 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 |
---|---|---|
|
@@ -12,6 +12,8 @@ POCKET_ADDR_PREFIX = pokt | |
.PHONY: install_ci_deps | ||
install_ci_deps: ## Installs `mockgen` | ||
go install "github.com/golang/mock/[email protected]" && mockgen --version | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
######################## | ||
### Makefile Helpers ### | ||
|
@@ -35,9 +37,9 @@ help: ## Prints all the targets in all the Makefiles | |
### Checks ### | ||
############## | ||
|
||
.PHONY: go_version_check | ||
.PHONY: check_go_version | ||
# Internal helper target - check go version | ||
go_version_check: | ||
check_go_version: | ||
@# Extract the version number from the `go version` command. | ||
@GO_VERSION=$$(go version | cut -d " " -f 3 | cut -c 3-) && \ | ||
MAJOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 1) && \ | ||
|
@@ -48,16 +50,27 @@ go_version_check: | |
exit 1; \ | ||
fi | ||
|
||
.PHONY: docker_check | ||
.PHONY: check_docker | ||
# Internal helper target - check if docker is installed | ||
docker_check: | ||
check_docker: | ||
{ \ | ||
if ( ! ( command -v docker >/dev/null && (docker compose version >/dev/null || command -v docker-compose >/dev/null) )); then \ | ||
echo "Seems like you don't have Docker or docker-compose installed. Make sure you review build/localnet/README.md and docs/development/README.md before continuing"; \ | ||
exit 1; \ | ||
fi; \ | ||
} | ||
|
||
.PHONY: check_godoc | ||
# Internal helper target - check if godoc is installed | ||
check_godoc: | ||
{ \ | ||
if ( ! ( command -v godoc >/dev/null )); then \ | ||
echo "Seems like you don't have godoc installed. Make sure you install it via 'go install golang.org/x/tools/cmd/godoc@latest' before continuing"; \ | ||
exit 1; \ | ||
fi; \ | ||
} | ||
|
||
|
||
.PHONY: warn_destructive | ||
warn_destructive: ## Print WARNING to the user | ||
@echo "This is a destructive action that will affect docker resources outside the scope of this repo!" | ||
|
@@ -76,7 +89,7 @@ proto_regen: ## Delete existing protobuf artifacts and regenerate them | |
####################### | ||
|
||
.PHONY: docker_wipe | ||
docker_wipe: docker_check warn_destructive prompt_user ## [WARNING] Remove all the docker containers, images and volumes. | ||
docker_wipe: check_docker warn_destructive prompt_user ## [WARNING] Remove all the docker containers, images and volumes. | ||
docker ps -a -q | xargs -r -I {} docker stop {} | ||
docker ps -a -q | xargs -r -I {} docker rm {} | ||
docker images -q | xargs -r -I {} docker rmi {} | ||
|
@@ -104,6 +117,17 @@ localnet_regenesis: ## Regenerate the localnet genesis file | |
cp ${HOME}/.pocket/config/*_key.json $(POCKETD_HOME)/config/ | ||
cp ${HOME}/.pocket/config/genesis.json $(POCKETD_HOME)/config/ | ||
|
||
############### | ||
### Linting ### | ||
############### | ||
|
||
.PHONY: go_lint | ||
go_lint: ## Run all go linters | ||
golangci-lint run --timeout 5m | ||
|
||
go_imports: check_go_version ## Run goimports on all go files | ||
go run ./tools/scripts/goimports | ||
|
||
############# | ||
### Tests ### | ||
############# | ||
|
@@ -113,22 +137,21 @@ test_e2e: ## Run all E2E tests | |
export POCKET_NODE=$(POCKET_NODE) POCKETD_HOME=../../$(POCKETD_HOME) && go test -v ./e2e/tests/... -tags=e2e | ||
|
||
.PHONY: go_test | ||
go_test: go_version_check ## Run all go tests | ||
go_test: check_go_version ## Run all go tests | ||
go test -v -race -tags test ./... | ||
|
||
.PHONY: go_test_integration | ||
go_test_integration: go_version_check ## Run all go tests, including integration | ||
go_test_integration: check_go_version ## Run all go tests, including integration | ||
go test -v -race -tags test,integration ./... | ||
|
||
.PHONY: itest | ||
itest: go_version_check ## Run tests iteratively (see usage for more) | ||
itest: check_go_version ## Run tests iteratively (see usage for more) | ||
./tools/scripts/itest.sh $(filter-out $@,$(MAKECMDGOALS)) | ||
# catch-all target for itest | ||
%: | ||
# no-op | ||
@: | ||
|
||
|
||
.PHONY: go_mockgen | ||
go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules. | ||
find . -name "*_mock.go" | xargs --no-run-if-empty rm | ||
|
@@ -391,3 +414,12 @@ acc_balance_total_supply: ## Query the total supply of the network | |
.PHONY: ignite_acc_list | ||
ignite_acc_list: ## List all the accounts in LocalNet | ||
ignite account list --keyring-dir=$(POCKETD_HOME) --keyring-backend test --address-prefix $(POCKET_ADDR_PREFIX) | ||
|
||
##################### | ||
### Documentation ### | ||
##################### | ||
.PHONY: go_docs | ||
go_docs: check_godoc ## Generate documentation for the project | ||
echo "Visit http://localhost:6060/pkg/pocket/" | ||
godoc -http=:6060 | ||
|
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
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.