Skip to content
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

[Refactoring]: fix sca problems #2133

Closed
1 task done
sukki37 opened this issue Apr 2, 2022 · 5 comments
Closed
1 task done

[Refactoring]: fix sca problems #2133

sukki37 opened this issue Apr 2, 2022 · 5 comments
Assignees
Milestone

Comments

@sukki37
Copy link
Contributor

sukki37 commented Apr 2, 2022

Is there an existing issue for the refactoring request?

  • I have checked the existing issues.

Is your refactoring request related to a problem?

For now, several code files in our repo are undesirable from the perspective of static analysis tools, please fix these questions asap.

You can execute sca locally by following steps:

1. `make install-static-check-tools`
2. `make static-check`

Describe the solution you'd like

check every warning and fix it.

Describe alternatives you've considered

No response

Additional information

No response

@sukki37
Copy link
Contributor Author

sukki37 commented Apr 2, 2022

A sca result in 20220420 is as follows:
lint.result.zip

@sukki37
Copy link
Contributor Author

sukki37 commented May 6, 2022

220506 Updated:
The following files still failed static check:

cmd/db-server/debug
cmd/db-server/main
pkg/compress/compress_test
pkg/container/batch/batch
pkg/container/nulls/nulls_test
pkg/container/ring/approxcd/approx
pkg/container/ring/approxcd/types
pkg/container/types/bytes_test
pkg/container/vector/vector_test
pkg/defines/type
pkg/errno/errcode
pkg/frontend/epochgc_test
pkg/frontend/mysql_cmd_executor
pkg/frontend/mysql_cmd_executor_test
pkg/frontend/mysql_protocol_test
pkg/rpcserver/codec
pkg/rpcserver/server
pkg/rpcserver/server_test
pkg/sort/asc/varchar/sort
pkg/sort/desc/varchar/sort
pkg/sql/colexec/connector/connector
pkg/sql/colexec/order/order
pkg/sql/parsers
pkg/sql/parsers/dialect/mysql/mysql_lexer
pkg/sql/parsers/scanner/scanner_test
pkg/sql/parsers/tree/precedence
pkg/sql/plan/create_table
pkg/sql/plan/name
pkg/sql/plan2/build_expr
pkg/sql/plan2/build_from
pkg/sql/plan2/build_select
pkg/sql/plan2/build_util
pkg/sql/plan2/function
pkg/sql/plan2/mock
pkg/sql/protocol/protocol
pkg/sql/protocol/protocol_test
pkg/vm/engine/format
pkg/vm/engine/memEngine/relation
pkg/vm/engine/tpe/descriptor/types
pkg/vm/engine/tpe/doc
pkg/vm/engine/tpe/engine/database
pkg/vm/engine/tpe/engine/relation
pkg/vm/engine/tpe/orderedcodec/constants
pkg/vm/engine/tpe/orderedcodec/types
pkg/vm/engine/tpe/tuplecodec/computationhandler_test
pkg/vm/engine/tpe/tuplecodec/cubekv
pkg/vm/engine/tpe/tuplecodec/cubekv_test
pkg/vm/engine/tpe/tuplecodec/decoder
pkg/vm/engine/tpe/tuplecodec/descriptorhandler
pkg/vm/engine/tpe/tuplecodec/encoder
pkg/vm/engine/tpe/tuplecodec/indexhandler
pkg/vm/engine/tpe/tuplecodec/memorykv
pkg/vm/engine/tpe/tuplecodec/rowcolumnconverter
pkg/vm/engine/tpe/tuplecodec/rowcolumnconverter_test
pkg/vm/engine/tpe/tuplecodec/serialize
pkg/vm/engine/tpe/tuplecodec/util
pkg/vm/pipeline/pipeline

details refered to lint-b2cfd19.txt

@cnutshell
Copy link
Contributor

cnutshell commented May 12, 2022

Linter stylecheck doesn't work now.

golangci-lint run --disable-all -E stylecheck
WARN [linters context] stylecheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.

The same as rowserrcheck.

@cnutshell
Copy link
Contributor

Now with errcheck disabled, it is likely that linter marked cases fade away, for those commits that is newer than 00b87be7 under branch main.

This could be verified via the following command:

golangci-lint run \
    -E misspell -E exportloopref -E rowserrcheck -E depguard \
    -D unconvert -E prealloc -E gofmt -E stylecheck -D errcheck

For cases marked by errcheck, I would make specific issues for people who take charge of relevant package.

@cnutshell
Copy link
Contributor

cnutshell commented May 13, 2022

Now all the cases for non-test code, which marked via linter errcheck, are covered.

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

No branches or pull requests

6 participants