pingcap / tiflash

The analytical engine for TiDB and TiDB Cloud. Try free: https://tidbcloud.com/free-trial
https://docs.pingcap.com/tidb/stable/tiflash-overview
Apache License 2.0
943 stars 410 forks source link

Fix clang-tidy error in `dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp` #4603

Closed Lloyd-Pottiger closed 2 years ago

Lloyd-Pottiger commented 2 years ago

Enhancement

clang-tidy -p=/home/finder/projects/tiflash/build/ /home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp
/home/finder/projects/tiflash/contrib/boost/boost/config/detail/select_stdlib_config.hpp:26:14: error: 'cstddef' file not found [clang-diagnostic-error]
#    include <cstddef>
             ^
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:47:23: error: method 'abandon' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
void DeltaValueSpace::abandon(DMContext & context)
                      ^
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:71:60: error: parameter 'head_column_files' is unused [misc-unused-parameters,-warnings-as-errors]
                                       const ColumnFiles & head_column_files,
                                                           ^~~~~~~~~~~~~~~~~
                                                            /*head_column_files*/
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:102:23: error: method 'appendColumnFile' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
bool DeltaValueSpace::appendColumnFile(DMContext & /*context*/, const ColumnFilePtr & column_file)
                      ^
static 
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:102:87: error: parameter 'column_file' is unused [misc-unused-parameters,-warnings-as-errors]
bool DeltaValueSpace::appendColumnFile(DMContext & /*context*/, const ColumnFilePtr & column_file)
                                                                                      ^~~~~~~~~~~
                                                                                       /*column_file*/
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:106:16: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
        return false;
~~~~~~~~~~~~~~~^~~~~~
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:112:23: error: method 'appendToCache' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
bool DeltaValueSpace::appendToCache(DMContext & context, const Block & block, size_t offset, size_t limit)
                      ^
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:116:16: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
        return false;
~~~~~~~~~~~~~~~^~~~~~
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:122:23: error: method 'appendDeleteRange' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
bool DeltaValueSpace::appendDeleteRange(DMContext & /*context*/, const RowKeyRange & delete_range)
                      ^
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:126:16: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
        return false;
~~~~~~~~~~~~~~~^~~~~~
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:132:23: error: method 'ingestColumnFiles' can be made static [readability-convert-member-functions-to-static,-warnings-as-errors]
bool DeltaValueSpace::ingestColumnFiles(DMContext & /*context*/, const RowKeyRange & range, const ColumnFiles & column_files, bool clear_data_in_range)
                      ^
static 
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:132:113: error: parameter 'column_files' is unused [misc-unused-parameters,-warnings-as-errors]
bool DeltaValueSpace::ingestColumnFiles(DMContext & /*context*/, const RowKeyRange & range, const ColumnFiles & column_files, bool clear_data_in_range)
                                                                                                                ^~~~~~~~~~~~
                                                                                                                 /*column_files*/
/home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp:136:16: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
        return false;
~~~~~~~~~~~~~~~^~~~~~
32812 warnings and 1 error generated.
Error while processing /home/finder/projects/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp.
Suppressed 32819 warnings (32800 in non-user code, 19 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings treated as errors
JigaoLuo commented 2 years ago
clang-tidy -p=/home/jigao/Workspace/tiflash/build/ /home/jigao/Workspace/tiflash/dbms/src/Storages/DeltaMerge/Delta/DeltaValueSpace.cpp
100576 warnings generated.
Suppressed 100602 warnings (100576 in non-user code, 26 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

My clang-tidy tells me everything is fine. If that is true, then this issue can be closed.

JigaoLuo commented 2 years ago

/assign

Lloyd-Pottiger commented 2 years ago

My clang-tidy tells me everything is fine. If that is true, then this issue can be closed.

Yeah, you are right. Thank you~