Skip to content

Conversation

@algojack
Copy link
Contributor

@algojack algojack commented Jul 26, 2021

Summary

Adding linter for partitiontest (as well as tests for the linter)

Test Plan

Ran tests from VCS and from terminal using manual way in cmd/partitiontest_linter: go test -v
Output:

% go test -v
=== RUN   TestAll
--- PASS: TestAll (0.81s)
PASS
ok      command-line-arguments  1.244s

As well as run the linter manually in cmd/partitiontest_linter/: go run plugin/plugin.go -- ./... from root of repo.
Expected output is a list of files and functions with exit error code 3:

/Users/jack/projects/algojack.go-algorand/cmd/partitiontest_linter/linter_test.go:25:1: TestAll function is missing partitiontest.PartitionTest(<T type parameter>)
exit status 3

And finally ran them using golangci-lint run from root of repo:

% golangci-lint run
...
logging/telemetryhook_test.go:172:1: lint: TestAsyncTelemetryHook_CloseDrop function is missing partitiontest.PartitionTest(<T type parameter>) (partitiontest)
func TestAsyncTelemetryHook_CloseDrop(t *testing.T) {
^
logging/telemetryhook_test.go:197:1: lint: TestAsyncTelemetryHook_QueueDepth function is missing partitiontest.PartitionTest(<T type parameter>) (partitiontest)
func TestAsyncTelemetryHook_QueueDepth(t *testing.T) {
^
daemon/algod/api/server/v1/handlers/handlers_test.go:31:1: lint: TestDecorateUnknownTransactionTypeError function is missing partitiontest.PartitionTest(<T type parameter>) (partitiontest)
func TestDecorateUnknownTransactionTypeError(t *testing.T) {
^
test/e2e-go/cli/goal/expect/goal_expect_test.go:26:1: lint: TestGoalWithExpect function is missing partitiontest.PartitionTest(<T type parameter>) (partitiontest)
func TestGoalWithExpect(t *testing.T) {
^
...

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some coding style remarks. Plus I do not think we need to commit compiled binary here

@algojack
Copy link
Contributor Author

algojack commented Jul 27, 2021

not ready for merge yet, still need to hook into .golangci.yml hooked into golangci now. all good.

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better, but still need to figure out what to do with the binary

@algorandskiy algorandskiy self-requested a review July 27, 2021 18:16
@algojack algojack changed the title Jack/custom search Jack/custom-search (partitiontest_linter) Jul 28, 2021
@algojack
Copy link
Contributor Author

Looks much better, but still need to figure out what to do with the binary

so i built it on my machine for now. But depending on where we run it, we should be able to build it there as needed. We have a few options, but open to suggestions too:

  1. don't build binary executable plugin.so file == build it where we use it
  2. build it and include in this repo (not something we usually do)
  3. build it and have a separate repo for plugin(s), so we just pull it from there to where we use it

@cce
Copy link
Contributor

cce commented Jul 28, 2021

IMO I don't think we should include a binary .so file in the repo. We can just build it when we need it.

@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2021

Codecov Report

Merging #2635 (9790a6e) into master (916154b) will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2635      +/-   ##
==========================================
- Coverage   47.00%   46.98%   -0.03%     
==========================================
  Files         348      348              
  Lines       55717    55717              
==========================================
- Hits        26188    26176      -12     
- Misses      26588    26597       +9     
- Partials     2941     2944       +3     
Impacted Files Coverage Δ
ledger/blockqueue.go 82.18% <0.00%> (-2.88%) ⬇️
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
network/wsPeer.go 74.93% <0.00%> (-0.56%) ⬇️
network/wsNetwork.go 60.92% <0.00%> (ø)
data/transactions/verify/txn.go 48.45% <0.00%> (ø)
catchup/peerSelector.go 100.00% <0.00%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 916154b...9790a6e. Read the comment docs.

@algojack
Copy link
Contributor Author

removed binary. To build it i did:

cd cmd/partitiontest_linter/
go build -buildmode=plugin -trimpath plugin/plugin.go

cce
cce previously approved these changes Jul 29, 2021
Copy link
Contributor

@cce cce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, after we merge this we can pull it into #2647 and figure out how to set up different golangci-lint configs for CI vs local, required vs suggested, etc.

algorandskiy
algorandskiy previously approved these changes Jul 29, 2021
@algojack algojack dismissed stale reviews from algorandskiy and cce via 9790a6e July 29, 2021 16:20
@algorandskiy algorandskiy changed the title Jack/custom-search (partitiontest_linter) Implement partitiontest_linter Jul 29, 2021
@algojohnlee algojohnlee merged commit 911bb55 into algorand:master Jul 29, 2021
@algojack algojack deleted the jack/custom-search branch July 29, 2021 18:27
algojack added a commit that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants