Add staticcheck #203
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#203
Loading…
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:refactoring/staticcheck"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://staticcheck.io/ is not the same as golang-cli staticcheck linter.
95f67b250f
to7927f48961
Typo in commit message "[#203] pilarama: Refactor tests" ->
[#203] pilorama...
I do believe it is a good thing but do we have any issue/discussion about that?
Also, we usually end commit messages (body, not header) with a period.
@ -286,6 +286,7 @@ func parseNNSResolveResult(res stackitem.Item) (util.Uint160, error) {
func nnsIsAvailable(c Client, nnsHash util.Uint160, name string) (bool, error) {
switch ct := c.(type) {
case *rpcclient.Client:
//lint:ignore SA1019 https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/202
can that be fixed in one place like it was already done?
It is possible. But I think that we should not disable this check for the entire project.
@ -79,3 +79,2 @@
commonCmd.ExitOnErr(cmd, "",
fmt.Errorf("Container wasn't removed because LOCK objects were found.\n"+
"Use --%s flag to remove anyway.", commonflags.ForceFlag))
fmt.Errorf("container wasn't removed because LOCK objects were found.\n"+
that is a CLI util output, is that change really necessary?
Anyway there is a check for the format of the error text.
Fixed error text format to match other errors.
I believe
cmd.PrintErrLn
called insideExitOnErr
should printError:
prefix.There is no prefix
This is my initiative. We can discuss it here.
@ -134,1 +134,4 @@
# Run staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/staticcheck@latest
Can I still run this target without network connection?
No. Fixed.
pre-commit run -a -hook-stage manual
for those who don't like to have pre-commit enabled in local repo clone@ -86,3 +86,3 @@
info1 := b1.Shards[i].GetBlobstor()
info2 := b2.Shards[i].GetBlobstor()
return compareBlobstorInfo(info1, info2)
if !compareBlobstorInfo(info1, info2) {
Interesting...
False positive?
I think it is interesting that staticcheck can find this.
The rule is probably "see if we return on every branch in the loop body".
Shouldn't catch this, though:
@ -60,3 +59,3 @@
// Returns nil, nil if the tombstone has been removed
// or marked for removal.
func (s Source) Tombstone(ctx context.Context, a oid.Address, _ uint64) (*object.Object, error) {
func (s Source) Tombstone(ctx context.Context, a oid.Address, _ uint64) (*objectSDK.Object, error) {
Was that linter suggestion/warning? This PR has truncated
*SDK
suffix in many places but here it's been added. Maybe we should keepobject
and just removeobjectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
?Fixed.
We have
object
package in core and api. To improve readability our unwritten rule is to useobjectSDK
andobjectAPI
explicitly.Now we know this rule. Fixed to objectSDK.
We wanted to write a linter for this at one point.
7927f48961
to3492eccc2a
fixed
3492eccc2a
to54d015c94b
54d015c94b
to7fd95ce34b
LGTM
7fd95ce34b
to1e7e8d110f
We will discuss it. Currently replaced local hook with external.
Done.
Fixed
Fixed.
1e7e8d110f
to13e6c0040a
13e6c0040a
to2f4207b7e8
2f4207b7e8
to9027695371