ydb-go-sdk icon indicating copy to clipboard operation
ydb-go-sdk copied to clipboard

enable gocognit linter

Open grishagavrin opened this issue 1 year ago • 3 comments

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Pull request type

Please check the type of change your PR introduces:

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [x] Refactoring (no functional changes, no api changes)
  • [x] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

Issue Number: #938

What is the new behavior?

Other information

First I load the files with the linter turned off to check the ci tests. I have the linter enabled locally and with the last commit I enabled the linter in the remote repository.

grishagavrin avatar Feb 08 '24 07:02 grishagavrin

Codecov Report

Attention: 230 lines in your changes are missing coverage. Please review.

Comparison is base (c6e45cd) 68.48% compared to head (57a84ee) 68.72%.

Files Patch % Lines
internal/table/scanner/scanner.go 41.56% 87 Missing and 10 partials :warning:
internal/decimal/decimal.go 0.00% 35 Missing :warning:
log/table.go 83.65% 29 Missing and 5 partials :warning:
sugar/path.go 43.24% 17 Missing and 4 partials :warning:
log/sql.go 76.47% 8 Missing and 4 partials :warning:
internal/xsql/dsn.go 66.66% 6 Missing and 2 partials :warning:
retry/retry.go 27.27% 7 Missing and 1 partial :warning:
internal/bind/params.go 80.00% 4 Missing and 2 partials :warning:
internal/table/client.go 78.57% 2 Missing and 1 partial :warning:
log/topic.go 97.18% 0 Missing and 2 partials :warning:
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1037      +/-   ##
==========================================
+ Coverage   68.48%   68.72%   +0.24%     
==========================================
  Files         252      252              
  Lines       25155    25420     +265     
==========================================
+ Hits        17228    17471     +243     
- Misses       7069     7093      +24     
+ Partials      858      856       -2     
Flag Coverage Δ
55.48% <60.96%> (+0.29%) :arrow_up:
go-1.20.x 68.57% <70.84%> (+0.30%) :arrow_up:
go-1.21.x 68.67% <70.84%> (+0.21%) :arrow_up:
integration 55.48% <60.96%> (+0.29%) :arrow_up:
macOS 38.34% <15.71%> (-0.32%) :arrow_down:
ubuntu 38.38% <15.71%> (-0.30%) :arrow_down:
unit 38.44% <15.71%> (-0.30%) :arrow_down:
windows 38.38% <15.71%> (-0.34%) :arrow_down:
ydb-22.5 55.00% <60.96%> (+0.17%) :arrow_up:
ydb-23.1 54.98% <59.31%> (+0.04%) :arrow_up:
ydb-23.2 55.16% <60.96%> (+0.34%) :arrow_up:
ydb-23.3 55.22% <59.31%> (+0.23%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Feb 08 '24 07:02 codecov-commenter

I noted one comment //nolint:gocognit, because if I rewrite a function internal/cmd/gtrace.findGtraceGen in for _, c := range v.List { if strings.Contains(strings.TrimPrefix(c.Text, "//"), "gtrace:gen") { if item == nil { item = &GenItem{} } } } the autotest breaks either tests / unit (1.21.x, windows)

grishagavrin avatar Feb 10 '24 10:02 grishagavrin

Summary of review:

  1. Need to rebase to master
  2. Need to add exclude-rules into .golangci.yaml config for:
    • all tests
    • packages log and metrics
  3. Need to add unit tests for newest funcs
  4. Minor issues see in full review

asmyasnikov avatar Mar 07 '24 13:03 asmyasnikov