Repository navigation
test: rc.29 e2e (old: cpp-linter 2.0.0rc27) - #90
shenxianpeng wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
cpp-linter review
7 comments (clang-format 23.1.6, clang-tidy 23.1.6)
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
| int top_dash( ){return 1;} | |
| static int top_dash() { return 1; } |
| total += 14; | ||
| return total; | ||
| } | ||
| // touched |
There was a problem hiding this comment.
clang-format suggests this formatting.
| // touched | |
| // touched |
| @@ -0,0 +1,2 @@ | |||
| #include "missing_lib.h" | |||
| int use_two(){return lib_value();} | |||
There was a problem hiding this comment.
Warning: misc-use-internal-linkage
function 'use_two' can be made static or moved into an anonymous namespace to enforce internal linkage
| int use_two(){return lib_value();} | |
| static int use_two() { return lib_value(); } |
| @@ -0,0 +1,2 @@ | |||
| #include "missing_lib.h" | |||
| int fixits(int x, int *p) { | ||
| if (p == 0) | ||
| return 0; | ||
| if (x > 1) | ||
| return 1; | ||
| else | ||
| return 2; |
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: misc-const-correctness
pointee of variable 'p' of type 'int *' can be declared 'const'
Warning: readability-non-const-parameter
pointer parameter 'p' can be pointer to const
Warning: readability-braces-around-statements
statement should be inside braces
Warning: readability-braces-around-statements
statement should be inside braces
Warning: readability-else-after-return
do not use 'else' after 'return'
Warning: readability-braces-around-statements
statement should be inside braces
| int fixits(int x, int *p) { | |
| if (p == 0) | |
| return 0; | |
| if (x > 1) | |
| return 1; | |
| else | |
| return 2; | |
| static int fixits(int x, const int const* p) | |
| { | |
| if (p == 0) { | |
| return 0; | |
| } | |
| if (x > 1) { | |
| return 1; | |
| } | |
| { | |
| return 2; | |
| } |
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 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: misc-const-correctness
variable 'x' of type 'int' can be declared 'const'
| int added(){ | |
| int x=1; | |
| printf("%d",x); | |
| return x;} | |
| static int added() | |
| { | |
| int const x = 1; | |
| printf("%d", x); | |
| return x; | |
| } |
Warning: readability-identifier-length
variable name 'x' is too short, expected at least 3 characters
| 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
| int edited_space( ){return 1;} | |
| static int edited_space() { return 1; } |
|
| Tool | Result |
|---|---|
| all files formatted | |
| 1 error, 9 warnings |
clang-tidy: 1 error, 9 warnings
-top.cpp
| Line | Finding |
|---|---|
| 1 | function 'top_dash' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
incdemo/use2.cpp
| Line | Finding |
|---|---|
| 1 | error: 'missing_lib.h' file not found clang-diagnostic-error |
| 2 | function 'use_two' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
src/fixits.cpp
| Line | Finding |
|---|---|
| 1 | function 'fixits' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
| 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 |
src/no_final_newline.cpp
| Line | Finding |
|---|---|
| 2 | function 'added' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
| 4 | variable name 'x' is too short, expected at least 3 characters readability-identifier-length |
stress/latin1.cpp
| Line | Finding |
|---|---|
| 7 | function 'edited_latin1' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
stress/with space.cpp
| Line | Finding |
|---|---|
| 6 | function 'edited_space' declared 'static', move to anonymous namespace instead misc-use-anonymous-namespace |
How to fix
For the clang-tidy findings, give this to your coding agent:
Fix these clang-tidy findings:
- -top.cpp:1:12: warning: function 'top_dash' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
- incdemo/use2.cpp:1:10: error: 'missing_lib.h' file not found [clang-diagnostic-error]
- incdemo/use2.cpp:2:12: warning: function 'use_two' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
- src/fixits.cpp:1:12: warning: function 'fixits' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
- src/fixits.cpp:1:23: warning: parameter name 'x' is too short, expected at least 3 characters [readability-identifier-length]
- src/fixits.cpp:1:43: warning: parameter name 'p' is too short, expected at least 3 characters [readability-identifier-length]
- src/no_final_newline.cpp:2:12: warning: function 'added' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
- src/no_final_newline.cpp:4:15: warning: variable name 'x' is too short, expected at least 3 characters [readability-identifier-length]
- stress/latin1.cpp:7:12: warning: function 'edited_latin1' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
- stress/with space.cpp:6:12: warning: function 'edited_space' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]
Powered by cpp-linter | Feedback
There was a problem hiding this comment.
cpp-linter review
7 comments (clang-format 23.1.7, clang-tidy 23.1.7)
1 comment was already posted in a previous review.
Powered by cpp-linter | Feedback
| @@ -0,0 +1 @@ | |||
| static int top_dash() { return 1; } | |||
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'top_dash' declared 'static', move to anonymous namespace instead
| @@ -0,0 +1,2 @@ | |||
| #include "missing_lib.h" | |||
| static int use_two() { return lib_value(); } | |||
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'use_two' declared 'static', move to anonymous namespace instead
| @@ -0,0 +1,12 @@ | |||
| static int fixits(int x, const int const* p) | |||
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'fixits' declared 'static', move to anonymous namespace instead
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
| @@ -0,0 +1,7 @@ | |||
| #include <cstdio> | |||
| static int added() | |||
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'added' declared 'static', move to anonymous namespace instead
| #include <cstdio> | ||
| static int added() | ||
| { | ||
| int const x = 1; |
There was a problem hiding this comment.
Warning: readability-identifier-length
variable name 'x' is too short, expected at least 3 characters
| int main(){ | ||
| char* p = NULL; | ||
| printf("%d\n",f(3)); return 0;} | ||
| static int edited_latin1() { return 3; } |
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'edited_latin1' declared 'static', move to anonymous namespace instead
| int main(){ | ||
| char* p = NULL; | ||
| printf("%d\n",f(3)); return 0;} | ||
| static int edited_space() { return 1; } |
There was a problem hiding this comment.
Warning: misc-use-anonymous-namespace
function 'edited_space' declared 'static', move to anonymous namespace instead
Requested by Xianpeng · project thread
Temporary pre-release test PR: the same fixture with action v3 (PR #543 head) unchanged (cpp-linter 2.0.0rc27 = rs rc.28), for comparison. Do not merge; close after the test.