From 907dcba1958b0250edac05e6b795c7c7b228ce90 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:56:56 -0500 Subject: [PATCH 1/6] try commenting out partitiontest linter --- .github/workflows/reviewdog.yml | 12 ++++++------ .golangci-warnings.yml | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 4a398e7101..1be0c0fb36 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -71,12 +71,12 @@ jobs: run: | curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2 reviewdog --version - - name: Build custom linters - run: | - cd cmd/partitiontest_linter/ - CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go - cd ../../ - ls -la cmd/partitiontest_linter/ + # - name: Build custom linters + # run: | + # cd cmd/partitiontest_linter/ + # CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go + # cd ../../ + # ls -la cmd/partitiontest_linter/ - name: Run golangci-lint with reviewdog env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci-warnings.yml b/.golangci-warnings.yml index d813e97e59..6ec633a0c8 100644 --- a/.golangci-warnings.yml +++ b/.golangci-warnings.yml @@ -6,16 +6,16 @@ linters: disable-all: true enable: - gosec - - partitiontest + # - partitiontest linters-settings: gosec: # we are mostly only interested in G601 excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404] - custom: - partitiontest: - path: cmd/partitiontest_linter/plugin.so - description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest()' - original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter + # custom: + # partitiontest: + # path: cmd/partitiontest_linter/plugin.so + # description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest()' + # original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter severity: default-severity: warning @@ -61,6 +61,6 @@ issues: - structcheck - varcheck - unused - - path: crypto/secp256k1/secp256_test\.go - linters: - - partitiontest + # - path: crypto/secp256k1/secp256_test\.go + # linters: + # - partitiontest From e147889d40db9009bf74f50ac4eaff04e9c0164a Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:03:16 -0500 Subject: [PATCH 2/6] change reviewdog warning flags to match reviewdog error flags --- .github/workflows/reviewdog.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 1be0c0fb36..704569bef9 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -92,8 +92,8 @@ jobs: cat temp_golangci-lint-cgo.txt | reviewdog \ -f=golangci-lint \ -name="Lint Warnings" \ - -reporter=github-check \ - -filter-mode=added \ + -reporter=github-pr-check \ + -filter-mode=nofilter \ -fail-on-error=true \ -level=warning - name: Slack Notification From 42b95392992b726fd67ca5745d6ab981f8d1176e Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:08:50 -0500 Subject: [PATCH 3/6] update excludes list --- .golangci-warnings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.golangci-warnings.yml b/.golangci-warnings.yml index 6ec633a0c8..52ee69a324 100644 --- a/.golangci-warnings.yml +++ b/.golangci-warnings.yml @@ -9,8 +9,8 @@ linters: # - partitiontest linters-settings: - gosec: # we are mostly only interested in G601 - excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404] + gosec: # Go 1.22 makes G601 irrelevant + excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404, G601] # custom: # partitiontest: # path: cmd/partitiontest_linter/plugin.so From c65c3a9fac6d59577316cff921f4df96deae6227 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:29:35 -0500 Subject: [PATCH 4/6] reenable partitiontest --- .github/workflows/reviewdog.yml | 20 +++++++++++--------- .golangci-warnings.yml | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 704569bef9..cbb1bf7147 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -1,4 +1,6 @@ name: "ReviewDog workflow" +env: + GOLANGCI_LINT_VERSION: "v1.62.0" on: push: branches: @@ -20,7 +22,7 @@ jobs: uses: reviewdog/action-golangci-lint@v2.6.2 with: go_version_file: go.mod - golangci_lint_version: "v1.62.0" + golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }} golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners" reporter: "github-pr-check" tool_name: "Lint Errors" @@ -56,14 +58,14 @@ jobs: uses: actions/cache@v3.3.1 with: path: cicdtmp/golangci-lint/golangci-lint-cgo - key: cicd-golangci-lint-cgo-v0.0.2-${{ env.GO_VERSION }} + key: cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }} - name: Build custom golangci-lint with CGO_ENABLED if: steps.cache-golangci-lint.outputs.cache-hit != 'true' run: | cd cicdtmp/golangci-lint git clone https://github.com/golangci/golangci-lint.git . - git checkout tags/v1.62.0 + git checkout tags/${GOLANGCI_LINT_VERSION} CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint ./golangci-lint-cgo --version cd ../../ @@ -71,12 +73,12 @@ jobs: run: | curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2 reviewdog --version - # - name: Build custom linters - # run: | - # cd cmd/partitiontest_linter/ - # CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go - # cd ../../ - # ls -la cmd/partitiontest_linter/ + - name: Build custom linters + run: | + cd cmd/partitiontest_linter/ + CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go + cd ../../ + ls -la cmd/partitiontest_linter/ - name: Run golangci-lint with reviewdog env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci-warnings.yml b/.golangci-warnings.yml index 52ee69a324..8ab68f9faf 100644 --- a/.golangci-warnings.yml +++ b/.golangci-warnings.yml @@ -6,16 +6,16 @@ linters: disable-all: true enable: - gosec - # - partitiontest + - partitiontest linters-settings: gosec: # Go 1.22 makes G601 irrelevant - excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404, G601] - # custom: - # partitiontest: - # path: cmd/partitiontest_linter/plugin.so - # description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest()' - # original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter + excludes: [G101, G103, G104, G107, G115, G202, G301, G302, G303, G304, G306, G307, G404, G601] + custom: + partitiontest: + path: cmd/partitiontest_linter/plugin.so + description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest()' + original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter severity: default-severity: warning @@ -61,6 +61,6 @@ issues: - structcheck - varcheck - unused - # - path: crypto/secp256k1/secp256_test\.go - # linters: - # - partitiontest + - path: crypto/secp256k1/secp256_test\.go + linters: + - partitiontest From f567965c5b8012b574a31175a0c1b98a65f0739e Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:44:53 -0500 Subject: [PATCH 5/6] add nolint for warning found --- data/transactions/logic/assembler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/transactions/logic/assembler.go b/data/transactions/logic/assembler.go index 06fd1f3953..9ba52138ec 100644 --- a/data/transactions/logic/assembler.go +++ b/data/transactions/logic/assembler.go @@ -2269,7 +2269,7 @@ func define(ops *OpStream, tokens []token) *sourceError { } else { delete(ops.macros, name) // remove new macro that caused cycle } - return tokens[1].errorf("macro expansion cycle discovered: %s", strings.Join(found, " -> ")) + return tokens[1].errorf("macro expansion cycle discovered: %s", strings.Join(found, " -> ")) //nolint:gosec // false positive, len(tokens) >= 3 } return nil } From 3bed8afba58e7664eb801a747919bb35a045fad6 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:04:53 -0500 Subject: [PATCH 6/6] switch to "added" instead of "nofilter" for warnings --- .github/workflows/reviewdog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index cbb1bf7147..f967bbd916 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -95,7 +95,7 @@ jobs: -f=golangci-lint \ -name="Lint Warnings" \ -reporter=github-pr-check \ - -filter-mode=nofilter \ + -filter-mode=added \ -fail-on-error=true \ -level=warning - name: Slack Notification