diff --git a/cpp/README.md b/cpp/README.md index 08c65400eb5db6527e63e24fa55abe4c640f1436..6e81b567ffd15b94fb6cd61b3a162723f933703d 100644 --- a/cpp/README.md +++ b/cpp/README.md @@ -121,9 +121,15 @@ $ sudo apt-get install clang-tidy clang-format $ rm cmake_build/CMakeCache.txt ``` +Check code style ```shell $ ./build.sh -l ``` +To format the code +```shell +$ cd cmake_build +$ make clang-format +``` ##### Run unit test diff --git a/cpp/build-support/lint_exclusions.txt b/cpp/build-support/lint_exclusions.txt index 6888dfa32cc2a592db774451bd85bf7783aa4b71..6ac690f661f56473d28d1bf476ccef9d7a944c81 100644 --- a/cpp/build-support/lint_exclusions.txt +++ b/cpp/build-support/lint_exclusions.txt @@ -5,4 +5,5 @@ *thirdparty* *easylogging++* *SqliteMetaImpl.cpp -*src/grpc* \ No newline at end of file +*src/grpc* +*milvus/include* \ No newline at end of file diff --git a/cpp/src/utils/ValidationUtil.cpp b/cpp/src/utils/ValidationUtil.cpp index 254f46f23d7b5f7ef4495552300d056166f0fd60..4345ebb704ede7206742dbe2b0c318f0b5e36f9e 100644 --- a/cpp/src/utils/ValidationUtil.cpp +++ b/cpp/src/utils/ValidationUtil.cpp @@ -99,7 +99,7 @@ ValidationUtil::ValidateTableIndexType(int32_t index_type) { Status ValidationUtil::ValidateTableIndexNlist(int32_t nlist) { if (nlist <= 0) { - std::string msg = "Invalid nlist value: " + std::to_string(nlist); + std::string msg = "nlist value should be greater than 0"; SERVER_LOG_ERROR << msg; return Status(SERVER_INVALID_INDEX_NLIST, msg); } @@ -132,7 +132,7 @@ ValidationUtil::ValidateTableIndexMetricType(int32_t metric_type) { Status ValidationUtil::ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchema& table_schema) { if (top_k <= 0 || top_k > 2048) { - std::string msg = "Invalid top k value: " + std::to_string(top_k); + std::string msg = "Invalid top k value: " + std::to_string(top_k) + ", rational range [1, 2048]"; SERVER_LOG_ERROR << msg; return Status(SERVER_INVALID_TOPK, msg); } @@ -143,7 +143,8 @@ ValidationUtil::ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchem Status ValidationUtil::ValidateSearchNprobe(int64_t nprobe, const engine::meta::TableSchema& table_schema) { if (nprobe <= 0 || nprobe > table_schema.nlist_) { - std::string msg = "Invalid nprobe value: " + std::to_string(nprobe); + std::string msg = "Invalid nprobe value: " + std::to_string(nprobe) + ", rational range [1, " + + std::to_string(table_schema.nlist_) + "]"; SERVER_LOG_ERROR << msg; return Status(SERVER_INVALID_NPROBE, msg); }