github-actions[bot] commented on code in PR #44454: URL: https://github.com/apache/doris/pull/44454#discussion_r1853843123
########## be/src/vec/runtime/vdatetime_value.cpp: ########## @@ -684,8 +685,8 @@ char* write_four_digits_to_string(int number, char* dst) { return dst + 4; } -bool VecDateTimeValue::to_format_string_conservative(const char* format, int len, char* to, - int max_valid_length) const { +bool VecDateTimeValue::to_format_string_conservative(const char* format, size_t len, char* to, Review Comment: warning: function 'to_format_string_conservative' has cognitive complexity of 60 (threshold 50) [readability-function-cognitive-complexity] ```cpp bool VecDateTimeValue::to_format_string_conservative(const char* format, size_t len, char* to, ^ ``` <details> <summary>Additional context</summary> **be/src/vec/runtime/vdatetime_value.cpp:689:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (check_range(_year, _month, _day, _hour, _minute, _second, _type)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:700:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp while (ptr < end) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:701:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (to - begin + SAFE_FORMAT_STRING_MARGIN > max_valid_length) [[unlikely]] { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:704:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (*ptr != '%' || (ptr + 1) == end) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:704:** +1 ```cpp if (*ptr != '%' || (ptr + 1) == end) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:710:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp switch (ch = *ptr++) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:761:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME || (_year == 0 && _month == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:761:** +1 ```cpp if (_type == TIME_TIME || (_year == 0 && _month == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:761:** +1 ```cpp if (_type == TIME_TIME || (_year == 0 && _month == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:768:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_month == 0) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:782:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_day >= 10 && _day <= 19) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:782:** +1 ```cpp if (_day >= 10 && _day <= 19) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:784:** +1, nesting level increased to 3 ```cpp } else { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:785:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp switch (_day % 10) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:828:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_month == 0) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:835:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if ((_hour % 24) >= 12) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:837:** +1, nesting level increased to 3 ```cpp } else { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:853:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if ((_hour % 24) >= 12) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:855:** +1, nesting level increased to 3 ```cpp } else { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:875:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:885:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:895:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:905:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:914:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME || (_month == 0 && _year == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:914:** +1 ```cpp if (_type == TIME_TIME || (_month == 0 && _year == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:914:** +1 ```cpp if (_type == TIME_TIME || (_month == 0 && _year == 0)) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:927:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` **be/src/vec/runtime/vdatetime_value.cpp:940:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_type == TIME_TIME) { ^ ``` </details> ########## be/src/vec/runtime/vdatetime_value.cpp: ########## @@ -3450,8 +3453,8 @@ } template <typename T> -bool DateV2Value<T>::to_format_string_conservative(const char* format, int len, char* to, - int max_valid_length) const { +bool DateV2Value<T>::to_format_string_conservative(const char* format, size_t len, char* to, Review Comment: warning: function 'to_format_string_conservative' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp bool DateV2Value<T>::to_format_string_conservative(const char* format, size_t len, char* to, ^ ``` <details> <summary>Additional context</summary> **be/src/vec/runtime/vdatetime_value.cpp:3455:** 256 lines including whitespace and comments (threshold 80) ```cpp bool DateV2Value<T>::to_format_string_conservative(const char* format, size_t len, char* to, ^ ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org