diff --git a/.editorconfig b/.editorconfig index 360ff39..b199bf5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,8 @@ tab_width = 4 ij_smart_tabs = true ij_continuation_indent_size = 4 max_line_length = 150 -ij_visual_guides = 80, 120 +# https://www.jetbrains.com/help/idea/editorconfig.html +ij_visual_guides = 80, 120, 150 ij_formatter_tags_enabled = true ij_formatter_on_tag = @formatter:on ij_formatter_off_tag = @formatter:off @@ -30,12 +31,21 @@ ij_go_run_go_fmt_on_reformat = true ij_go_call_parameters_wrap = on_every_item [{*.yml,*.yaml}] +indent_style = space +indent_size = 2 tab_width = 2 ij_wrap_on_typing = false ij_yaml_keep_indents_on_empty_lines = false [.idea/**.xml] +indent_style = space +indent_size = 2 +tab_width = 2 +ij_xml_space_inside_empty_tag = true insert_final_newline = false [Makefile] -ij_wrap_on_typing = false \ No newline at end of file +ij_wrap_on_typing = false + +[{LICENSE,*.adoc}] +max_line_length = off diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 0d4a013..bb69d24 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -1,11 +1,5 @@ -# Dependency Review Action -# -# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. -# -# Source repository: https://github.com/actions/dependency-review-action -# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement name: 'Dependency Review' -on: [pull_request] +on: [ pull_request ] permissions: contents: read diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..32e916f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +name: lint + +on: + push: + pull_request: + +jobs: + test-gomod: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - run: go mod tidy && git diff --exit-code go.mod go.sum + + test-generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + check-latest: true + + - run: make go-dependencies + + - run: make go-generate && git diff --exit-code + + editorconfig: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: editorconfig-checker/action-editorconfig-checker@main + - run: editorconfig-checker diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 7c3f622..b0a3347 100755 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -24,7 +24,7 @@ jobs: with: go-version: ${{ matrix.go }} - - run: make go-all-tests + - run: make go-test - name: Test Summary uses: test-summary/action@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/tests.yml similarity index 72% rename from .github/workflows/test.yml rename to .github/workflows/tests.yml index 6517c81..4c16d35 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/tests.yml @@ -5,15 +5,6 @@ on: pull_request: jobs: - test-gomod: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - run: go mod tidy && git diff --exit-code go.mod go.sum test: runs-on: ubuntu-latest @@ -27,10 +18,7 @@ jobs: check-latest: true - run: make go-dependencies - - - run: make go-generate && git diff --exit-code - - - run: make go-all-tests + - run: make go-test - name: Test Summary uses: test-summary/action@v2 diff --git a/.golangci.yml b/.golangci.yml index 4d851cd..4947722 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,62 +38,63 @@ linters-settings: require-specific: true lll: line-length: 150 + copyloopvar: + check-alias: true linters: disable-all: true enable: - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - unused - asasalint - bodyclose - containedctx - contextcheck + - copyloopvar - cyclop - dogsled + - err113 + - errcheck - errname - errorlint - exhaustive - - exportloopref - forbidigo - funlen + - ginkgolinter + # - gochecknoinits + - goconst - gocritic - gocyclo - - err113 - goimports - - mnd - - lll - gomoddirectives - goprintffuncname - # - gochecknoinits - - goconst - gosec + - gosimple - govet - grouper + - ineffassign + - interfacebloat + - lll - misspell + - mnd - nilerr - nlreturn - noctx - nolintlint + - nonamedreturns - prealloc - predeclared - promlinter - revive - - wastedassign + - staticcheck + - stylecheck - tagliatelle - tenv - testpackage - typecheck - unconvert - unparam + - unused - usestdlibvars - varnamelen + - wastedassign - whitespace - wsl - - ginkgolinter - - interfacebloat - - nonamedreturns - - stylecheck diff --git a/Makefile b/Makefile index b8dca57..d5c0952 100755 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ go-dependencies: $(eval GOBIN=$(shell go env GOPATH 2>/dev/null)/bin) curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) latest # + go install github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@latest + # go install github.com/onsi/ginkgo/v2/ginkgo@latest go-update: go-dependencies @@ -12,9 +14,10 @@ go-generate: go-dependencies $(MAKE) go-update go-lint: + editorconfig-checker golangci-lint run -go-test: go-lint +go-test: ginkgo -race --cover --coverprofile=.coverage-ginkgo.out --junit-report=junit-report.xml ./... go tool cover -func=.coverage-ginkgo.out -o=.coverage.out go tool cover -html=.coverage-ginkgo.out -o=coverage.html