Enable unparam and unconvert linters #1598

Merged
dstepanov-yadro merged 3 commits from dstepanov-yadro/frostfs-node:feat/add_linters into master 2025-01-14 08:27:24 +00:00

Add unparam and unconvert linters to make code cleaner.

Add `unparam` and `unconvert` linters to make code cleaner.
dstepanov-yadro added 2 commits 2025-01-13 14:45:46 +00:00
To drop unnecessary conversions.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
[#9999] node: Enable unparam linter
All checks were successful
DCO action / DCO (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 1m7s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m31s
Build / Build Components (pull_request) Successful in 1m37s
Tests and linters / Run gofumpt (pull_request) Successful in 2m7s
Tests and linters / Staticcheck (pull_request) Successful in 2m11s
Tests and linters / Lint (pull_request) Successful in 2m50s
Tests and linters / Tests (pull_request) Successful in 3m41s
Tests and linters / gopls check (pull_request) Successful in 4m6s
Tests and linters / Tests with -race (pull_request) Successful in 4m16s
a4481ddb4d
To drop unnecessary parameters and return values.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
dstepanov-yadro requested review from storage-core-committers 2025-01-13 14:45:47 +00:00
dstepanov-yadro requested review from storage-core-developers 2025-01-13 14:45:47 +00:00
dstepanov-yadro force-pushed feat/add_linters from a4481ddb4d to 6d18cbd791 2025-01-13 14:50:53 +00:00 Compare
a-savchuk approved these changes 2025-01-13 15:31:33 +00:00
Dismissed
a-savchuk left a comment
Member

unparam looks awesome🔥

node: Enable unconvert linters

Did you consider another scope for your commit message? For example, golangci or ci

Here are some of your commits from the past

[#1388] golangci: Make `unused` linter stricker
    
    Add aditional checks. The most important false positive - structs used as
    map keys.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>

...

[#857] golangci: Add protogetter linter
    
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
`unparam` looks awesome🔥 > node: Enable unconvert linters Did you consider another scope for your commit message? For example, `golangci` or `ci` Here are some of your commits from the past ``` [#1388] golangci: Make `unused` linter stricker Add aditional checks. The most important false positive - structs used as map keys. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> ... [#857] golangci: Add protogetter linter Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> ```
dstepanov-yadro force-pushed feat/add_linters from 6d18cbd791 to fb928616cc 2025-01-14 06:07:06 +00:00 Compare
Author
Member

unparam looks awesome🔥

node: Enable unconvert linters

Did you consider another scope for your commit message? For example, golangci or ci

Here are some of your commits from the past

[#1388] golangci: Make `unused` linter stricker
    
    Add aditional checks. The most important false positive - structs used as
    map keys.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>

...

[#857] golangci: Add protogetter linter
    
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>

Done

> `unparam` looks awesome🔥 > > > > node: Enable unconvert linters > > Did you consider another scope for your commit message? For example, `golangci` or `ci` > > Here are some of your commits from the past > ``` > [#1388] golangci: Make `unused` linter stricker > > Add aditional checks. The most important false positive - structs used as > map keys. > > Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> > > ... > > [#857] golangci: Add protogetter linter > > Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> > ``` Done
fyrchik approved these changes 2025-01-14 06:56:51 +00:00
Dismissed
@ -30,6 +30,8 @@ type InhumePrm struct {
// InhumeRes encapsulates results of inhume operation.
type InhumeRes struct{}
var inhumeRes = InhumeRes{}
Owner

Why was this a problem?

Why was this a problem?
Author
Member

Linter says that all return values of InhumeRes are the same, so this looks like there is no return value requered.
But we have an unspoken agreement to return the result and the error.
To make everyone happy, a global variable was introduced.

Linter says that all return values of `InhumeRes` are the same, so this looks like there is no return value requered. But we have an unspoken agreement to return the result and the error. To make everyone happy, a global variable was introduced.
Owner

I thought this was the reason we wanted this linter: what about removing Res struct where it is not needed?
This global variable looks like lint:ignore and may introduce problems later (were we to add a field and modify it somehow).

I thought this was the reason we wanted this linter: what about removing `Res` struct where it is not needed? This global variable looks like `lint:ignore` and may introduce problems later (were we to add a field and modify it somehow).
Author
Member

You're trying to destroy long-standing foundations!

You're trying to destroy long-standing foundations!
Owner

I am trying to refine them.
The addition of this linter is a worthy reason.

I am trying to refine them. The addition of this linter is a worthy reason.
Author
Member

Ok, fixed

Ok, fixed
acid-ant approved these changes 2025-01-14 08:18:28 +00:00
Dismissed
dstepanov-yadro added 1 commit 2025-01-14 08:19:02 +00:00
[#1598] engine: Drop unnecessary result structs
All checks were successful
DCO action / DCO (pull_request) Successful in 31s
Tests and linters / Run gofumpt (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 54s
Build / Build Components (pull_request) Successful in 1m29s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Tests and linters / gopls check (pull_request) Successful in 2m15s
Tests and linters / Lint (pull_request) Successful in 2m41s
Tests and linters / Staticcheck (pull_request) Successful in 2m49s
Tests and linters / Tests (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 5m1s
Vulncheck / Vulncheck (push) Successful in 1m5s
Pre-commit hooks / Pre-commit (push) Successful in 1m19s
Build / Build Components (push) Successful in 1m36s
Tests and linters / gopls check (push) Successful in 2m16s
Tests and linters / Run gofumpt (push) Successful in 2m32s
Tests and linters / Staticcheck (push) Successful in 2m49s
Tests and linters / Lint (push) Successful in 3m10s
Tests and linters / Tests (push) Successful in 3m12s
Tests and linters / Tests with -race (push) Successful in 4m15s
eff95bd632
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
dstepanov-yadro dismissed a-savchuk's review 2025-01-14 08:19:02 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

dstepanov-yadro dismissed fyrchik's review 2025-01-14 08:19:02 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

dstepanov-yadro dismissed acid-ant's review 2025-01-14 08:19:02 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

acid-ant approved these changes 2025-01-14 08:21:17 +00:00
aarifullin approved these changes 2025-01-14 08:21:36 +00:00
fyrchik approved these changes 2025-01-14 08:26:54 +00:00
dstepanov-yadro merged commit eff95bd632 into master 2025-01-14 08:27:24 +00:00
dstepanov-yadro deleted branch feat/add_linters 2025-01-14 08:27:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1598
No description provided.