Repository navigation
test: rc.28 e2e (old action) - #88
shenxianpeng wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
cpp-linter review
7 comments (clang-format 21.1.8, clang-tidy 21.1.8)
Some findings could not be posted as suggestions:
- stress/latin1.cpp: 1 fix is only in the patch file because the file is not UTF-8 encoded
Powered by cpp-linter | Feedback
| @@ -0,0 +1 @@ | |||
| int top_dash( ){return 1;} | |||
There was a problem hiding this comment.
Warning: misc-use-internal-linkage
function 'top_dash' can be made static or moved into an anonymous namespace to enforce internal linkage
Warning: modernize-use-trailing-return-type
use a trailing return type for this function
| int top_dash( ){return 1;} | |
| static auto top_dash() -> int { return 1; } |
| total += 14; | ||
| return total; | ||
| } | ||
| // touched |
There was a problem hiding this comment.
clang-format suggests this formatting.
| // touched | |
| // touched |
| int fixits(int x, int *p) { | ||
| if (p == 0) |
There was a problem hiding this comment.
Warning: misc-use-internal-linkage
function 'fixits' can be made static or moved into an anonymous namespace to enforce internal linkage
Warning: modernize-use-trailing-return-type
use a trailing return type for this function
Warning: readability-non-const-parameter
pointer parameter 'p' can be pointer to const
Warning: modernize-use-nullptr
use nullptr
Warning: readability-braces-around-statements
statement should be inside braces
| int fixits(int x, int *p) { | |
| if (p == 0) | |
| static auto fixits(int x, const int *p) -> int { | |
| if (p == nullptr) { |
Warning: readability-identifier-length
parameter name 'x' is too short, expected at least 3 characters
Warning: readability-identifier-length
parameter name 'p' is too short, expected at least 3 characters
| int fixits(int x, int *p) { | ||
| if (p == 0) | ||
| return 0; | ||
| if (x > 1) |
There was a problem hiding this comment.
Warning: readability-braces-around-statements
statement should be inside braces
| if (x > 1) | |
| } | |
| if (x > 1) { |
| else | ||
| return 2; |
There was a problem hiding this comment.
Warning: readability-braces-around-statements
statement should be inside braces
Warning: readability-else-after-return
do not use 'else' after 'return'
| else | |
| return 2; | |
| } | |
| return 2; |
Warning: readability-braces-around-statements
statement should be inside braces
| int added(){ | ||
| int x=1; | ||
| printf("%d",x); | ||
| return x;} No newline at end of file |
There was a problem hiding this comment.
Warning: misc-use-internal-linkage
function 'added' can be made static or moved into an anonymous namespace to enforce internal linkage
Warning: modernize-use-trailing-return-type
use a trailing return type for this function
Warning: misc-const-correctness
variable 'x' of type 'int' can be declared 'const'
| int added(){ | |
| int x=1; | |
| printf("%d",x); | |
| return x;} | |
| static auto added() -> int { | |
| int const x = 1; | |
| printf("%d", x); | |
| return x; | |
| } |
Warning: readability-identifier-length
variable name 'x' is too short, expected at least 3 characters
Warning: cppcoreguidelines-pro-type-vararg
do not call c-style vararg functions
| int main(){ | ||
| char* p = NULL; | ||
| printf("%d\n",f(3)); return 0;} | ||
| int edited_space( ){return 1;} |
There was a problem hiding this comment.
Warning: misc-use-internal-linkage
function 'edited_space' can be made static or moved into an anonymous namespace to enforce internal linkage
Warning: modernize-use-trailing-return-type
use a trailing return type for this function
| int edited_space( ){return 1;} | |
| static auto edited_space() -> int { return 1; } |
|
| Tool | Result |
|---|---|
| 5 files need formatting | |
| 21 warnings, 16 fixable |
clang-tidy: 21 warnings, 16 fixable
-top.cpp
| Line | Finding |
|---|---|
| 1 | function 'top_dash' can be made static or moved into an anonymous namespace to enforce internal linkage (fixable) misc-use-internal-linkage |
| 1 | use a trailing return type for this function (fixable) modernize-use-trailing-return-type |
src/fixits.cpp
| Line | Finding |
|---|---|
| 1 | function 'fixits' can be made static or moved into an anonymous namespace to enforce internal linkage (fixable) misc-use-internal-linkage |
| 1 | use a trailing return type for this function (fixable) modernize-use-trailing-return-type |
| 1 | parameter name 'x' is too short, expected at least 3 characters readability-identifier-length |
| 1 | parameter name 'p' is too short, expected at least 3 characters readability-identifier-length |
| 1 | pointer parameter 'p' can be pointer to const (fixable) readability-non-const-parameter |
| 2 | use nullptr (fixable) modernize-use-nullptr |
| 2 | statement should be inside braces (fixable) readability-braces-around-statements |
| 4 | statement should be inside braces (fixable) readability-braces-around-statements |
| 6 | do not use 'else' after 'return' (fixable) readability-else-after-return |
| 6 | statement should be inside braces readability-braces-around-statements |
src/no_final_newline.cpp
| Line | Finding |
|---|---|
| 2 | function 'added' can be made static or moved into an anonymous namespace to enforce internal linkage (fixable) misc-use-internal-linkage |
| 2 | use a trailing return type for this function (fixable) modernize-use-trailing-return-type |
| 3 | variable 'x' of type 'int' can be declared 'const' (fixable) misc-const-correctness |
| 3 | variable name 'x' is too short, expected at least 3 characters readability-identifier-length |
| 4 | do not call c-style vararg functions cppcoreguidelines-pro-type-vararg |
stress/latin1.cpp
| Line | Finding |
|---|---|
| 7 | function 'edited_latin1' can be made static or moved into an anonymous namespace to enforce internal linkage (fixable) misc-use-internal-linkage |
| 7 | use a trailing return type for this function (fixable) modernize-use-trailing-return-type |
stress/with space.cpp
| Line | Finding |
|---|---|
| 6 | function 'edited_space' can be made static or moved into an anonymous namespace to enforce internal linkage (fixable) misc-use-internal-linkage |
| 6 | use a trailing return type for this function (fixable) modernize-use-trailing-return-type |
clang-format: 5 files
-top.cpp, line 1cap/many.cpp, line 36src/no_final_newline.cpp, lines 2-5stress/latin1.cpp, line 7stress/with space.cpp, line 6
How to fix
From the repository root, format the listed lines with clang-format 21:
clang-format -i --style=llvm --lines=1:1 -top.cpp
clang-format -i --style=llvm --lines=36:36 cap/many.cpp
clang-format -i --style=llvm --lines=2:5 src/no_final_newline.cpp
clang-format -i --style=llvm --lines=7:7 stress/latin1.cpp
clang-format -i --style=llvm --lines=6:6 'stress/with space.cpp'Or apply every fix at once: this step's fix-patch-path output is a patch for git apply.
For the clang-tidy findings, give this to your coding agent:
Fix these clang-tidy findings:
- -top.cpp:1:7: warning: function 'top_dash' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- -top.cpp:1:7: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
- src/fixits.cpp:1:5: warning: function 'fixits' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- src/fixits.cpp:1:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
- src/fixits.cpp:1:16: warning: parameter name 'x' is too short, expected at least 3 characters [readability-identifier-length]
- src/fixits.cpp:1:24: warning: parameter name 'p' is too short, expected at least 3 characters [readability-identifier-length]
- src/fixits.cpp:1:24: warning: pointer parameter 'p' can be pointer to const [readability-non-const-parameter]
- src/fixits.cpp:2:12: warning: use nullptr [modernize-use-nullptr]
- src/fixits.cpp:2:14: warning: statement should be inside braces [readability-braces-around-statements]
- src/fixits.cpp:4:13: warning: statement should be inside braces [readability-braces-around-statements]
- src/fixits.cpp:6:3: warning: do not use 'else' after 'return' [readability-else-after-return]
- src/fixits.cpp:6:7: warning: statement should be inside braces [readability-braces-around-statements]
- src/no_final_newline.cpp:2:5: warning: function 'added' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- src/no_final_newline.cpp:2:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
- src/no_final_newline.cpp:3:3: warning: variable 'x' of type 'int' can be declared 'const' [misc-const-correctness]
- src/no_final_newline.cpp:3:9: warning: variable name 'x' is too short, expected at least 3 characters [readability-identifier-length]
- src/no_final_newline.cpp:4:3: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
- stress/latin1.cpp:7:7: warning: function 'edited_latin1' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- stress/latin1.cpp:7:7: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
- stress/with space.cpp:6:7: warning: function 'edited_space' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- stress/with space.cpp:6:7: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
Powered by cpp-linter | Feedback
Temporary PR for the cpp-linter-rs rc.28 end-to-end test (old action). Do not merge.
Generated by Claude Code