-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(lint): cleanup config and enable default linters for our code #764
base: master
Are you sure you want to change the base?
Conversation
f9798f5
to
3eddab0
Compare
3eddab0
to
bff54b5
Compare
bff54b5
to
8b2feae
Compare
44b1570
to
31da1de
Compare
_, err := rand.Read(blocksBytes[i]) | ||
assert.NoError(t, err) | ||
} | ||
blocksBytes := [][]byte{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these are the same values that were previously pseudo random generated, but I removed math/rand to make gosec
happy; alternatively I can (did 1 in the last commit):
- Use smaller deterministic values set without a generator and change the tests expectations since the generated values would be different. My preferred because randomness has no place where it's actually not needed. This is done in the last commit.
//nolint:gosec
a bunch of places (I don't recommend)- Disable gosec about weak generator for test files (eh it's ok, but not totally recommended either)
The same goes for a few other tests changed the same way as this one.
go vmSetup.serverVM.AppRequest(ctx, nodeID, requestID, time.Now().Add(1*time.Second), request) | ||
go func() { | ||
err := vmSetup.serverVM.AppRequest(ctx, nodeID, requestID, time.Now().Add(1*time.Second), request) | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note technically this should only be called in the test goroutine, but this would involve significant changes that are out of scope in this PR, so leaving this as is. It would still detect the failure, but may panic if the test goroutine finished and this goroutine fails after that.
err := a.trieDB.Dereference(a.lastAcceptedRoot) | ||
if err != nil { | ||
return false, fmt.Errorf("dereferencing last accepted root: %w", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: i forgot to check the error here, showing the point of errcheck
😄 Risky business otherwise!
1b632eb
to
17cf418
Compare
17cf418
to
48a4806
Compare
Co-authored-by: Martin HS <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Quentin McGaw <[email protected]>
- enable errcheck, gosimple, govet, staticcheck - only scans plugin directory and _ext.go files - fix lint errors
48a4806
to
c80529b
Compare
Why this should be merged
Enable default linters (errcheck, staticcheck, gosimple and staticcheck were missing) +
errorlint
for our code only:./plugin/*.go
files*libevm*.go
files_ext.go
filesMore linters can be added subsequently, but this PR fixes already quite a few errors already coming from enabling the default linters and errorlint in our code
How this works
How this was tested
Need to be documented?
No
Need to update RELEASES.md?
No