Skip to content

Commit

Permalink
chore: update lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Jan 12, 2024
1 parent b469aec commit 3e4e9bb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ current development landscape.
### Code Linting

- We employ `golangci-lint` for code linting in our development process. It ensures that code adheres to established standards, and any changes that do not pass the linting checks will trigger an error during the Continuous Integration (CI) process.
- You can run it locally by installing the `golangci-lint` binary and running `golangci-lint run` in the root directory of the repository.
- You can run it locally by installing the `golangci-lint` binary and running `make lint` in the root directory of the repository.
5 changes: 2 additions & 3 deletions .github/workflows/lint-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
# use the default if on main branch, otherwise use the pull request config
args: --timeout=30m --config=${{ github.event_name == 'pull_request' && '.golangci.pull-request.yml' || '.golangci.yml' }}
only-new-issues: ${{ github.event_name == 'pull_request' }}
args: --timeout=30m
only-new-issues: true
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
13 changes: 0 additions & 13 deletions .golangci.pull-request.yml

This file was deleted.

12 changes: 7 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Please refer to the official golangci-lint config documentation for more details:
# https://golangci-lint.run/usage/configuration/
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml

linters:
enable-all: true

run:
timeout: 10m
tests: false

linters:
disable:
- errcheck
- unused

issues:
max-issues-per-linter: 1000
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ export GO111MODULE=on

.PHONY: thor disco all clean test

thor:| go_version_check
help:
@egrep -h '\s#@\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?#@ "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'

thor:| go_version_check #@ Build the `thor` executable
@echo "building $@..."
@go build -v -o $(CURDIR)/bin/$@ -ldflags "-X main.version=$(THOR_VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.gitTag=$(GIT_TAG)" ./cmd/thor
@echo "done. executable created at 'bin/$@'"

disco:| go_version_check
disco:| go_version_check #@ Build the `disco` executable
@echo "building $@..."
@go build -v -o $(CURDIR)/bin/$@ -ldflags "-X main.version=$(DISCO_VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.gitTag=$(GIT_TAG)" ./cmd/disco
@echo "done. executable created at 'bin/$@'"
Expand All @@ -37,16 +40,25 @@ go_version_check:
fi \
fi

all: thor disco
all: thor disco #@ Build the `thor` and `disco` executables

clean:
clean: #@ Clean the build artifacts
-rm -rf \
$(CURDIR)/bin/thor \
$(CURDIR)/bin/disco
$(CURDIR)/bin/disco

test:| go_version_check
test:| go_version_check #@ Run the tests
@go test -cover $(PACKAGES)

test-coverage:| go_version_check
test-coverage:| go_version_check #@ Run the tests with coverage
@go test -race -coverprofile=coverage.out -covermode=atomic $(PACKAGES)
@go tool cover -html=coverage.out

lint_command_check:
@command -v golangci-lint || (echo "golangci-lint not found, please install it from https://golangci-lint.run/usage/install/")

lint: | go_version_check lint_command_check #@ Run 'golangci-lint' on new code changes
@golangci-lint run --new

lint-all: | go_version_check lint_command_check #@ Run 'golangci-lint' on the entire codebase
@golangci-lint run
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ git clone https://github.com/vechain/thor.git
cd thor
```

To see a list of all available commands, run `make help`

### Building

To build the main app `thor`, just run
Expand Down

0 comments on commit 3e4e9bb

Please sign in to comment.