Repository navigation
test: stress PR for cpp-linter-action v2 (baseline) - #78
shenxianpeng wants to merge 1 commit into
Conversation
Cpp-Linter Report
|
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v21.1.8
Only 5 out of 6 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/src/no_final_newline.cpp b/src/no_final_newline.cpp
--- a/src/no_final_newline.cpp
+++ b/src/no_final_newline.cpp
@@ -2,2 +2,2 @@
-int added(){
- int x=1;
+static auto added() -> int {
+ int const x = 1;
@@ -5 +5,2 @@ int added(){
- return x;}
\ No newline at end of file
+ return x;
+}
\ No newline at end of file
diff --git a/stress/with space.cpp b/stress/with space.cpp
--- a/stress/with space.cpp
+++ b/stress/with space.cpp
@@ -6 +6 @@ int main(){
-int edited_space( ){return 1;}
+static auto edited_space() -> int { return 1; }
diff --git a/stress/中文.cpp b/stress/中文.cpp
--- a/stress/中文.cpp
+++ b/stress/中文.cpp
@@ -6 +6 @@ int main(){
-int edited_cjk( ){return 2;}
+static auto edited_cjk() -> int { return 2; }
Used clang-format v21.1.8
Click here for the full clang-format patch
diff --git a/src/no_final_newline.cpp b/src/no_final_newline.cpp
--- a/src/no_final_newline.cpp
+++ b/src/no_final_newline.cpp
@@ -2,4 +2,5 @@
-int added(){
- int x=1;
- printf("%d",x);
- return x;}
\ No newline at end of file
+int added() {
+ int x = 1;
+ printf("%d", x);
+ return x;
+}
\ No newline at end of file
diff --git a/stress/with space.cpp b/stress/with space.cpp
--- a/stress/with space.cpp
+++ b/stress/with space.cpp
@@ -6 +6 @@ int main(){
-int edited_space( ){return 1;}
+int edited_space() { return 1; }
diff --git a/stress/中文.cpp b/stress/中文.cpp
--- a/stress/中文.cpp
+++ b/stress/中文.cpp
@@ -6 +6 @@ int main(){
-int edited_cjk( ){return 2;}
+int edited_cjk() { return 2; }
✨ Powered by cpp-linter -- ⭐ Star • ❤️ Sponsor • 💬 Feedback
| int added(){ | ||
| int x=1; | ||
| printf("%d",x); | ||
| return x;} No newline at end of file |
There was a problem hiding this comment.
clang-format suggestion
| int added(){ | |
| int x=1; | |
| printf("%d",x); | |
| return x;} | |
| int added() { | |
| int x = 1; | |
| printf("%d", x); | |
| return x; | |
| }``` | |
| ### clang-tidy diagnostic | |
| **src/no_final_newline.cpp:3:9:** warning: [[readability-identifier-length](https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-length.html)] | |
| > variable name 'x' is too short, expected at least 3 characters | |
| ```cpp | |
| 3 | int x=1; | |
| | ^ |
clang-tidy diagnostic
src/no_final_newline.cpp:4:3: warning: [cppcoreguidelines-pro-type-vararg]
do not call c-style vararg functions
4 | printf("%d",x);
| ^| int main(){ | ||
| char* p = NULL; | ||
| printf("%d\n",f(3)); return 0;} | ||
| int edited_space( ){return 1;} |
There was a problem hiding this comment.
clang-format suggestion
| int edited_space( ){return 1;} | |
| int edited_space() { return 1; } |
clang-tidy diagnostics
- function 'edited_space' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- use a trailing return type for this function [modernize-use-trailing-return-type]
| int edited_space( ){return 1;} | |
| static auto edited_space() -> int { return 1; } |
| int main(){ | ||
| char* p = NULL; | ||
| printf("%d\n",f(3)); return 0;} | ||
| int edited_cjk( ){return 2;} |
There was a problem hiding this comment.
clang-format suggestion
| int edited_cjk( ){return 2;} | |
| int edited_cjk() { return 2; } |
clang-tidy diagnostics
- function 'edited_cjk' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- use a trailing return type for this function [modernize-use-trailing-return-type]
| int edited_cjk( ){return 2;} | |
| static auto edited_cjk() -> int { return 2; } |
| int added(){ | ||
| int x=1; |
There was a problem hiding this comment.
clang-tidy diagnostics
- function 'added' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
- use a trailing return type for this function [modernize-use-trailing-return-type]
- variable 'x' of type 'int' can be declared 'const' [misc-const-correctness]
| int added(){ | |
| int x=1; | |
| static auto added() -> int { | |
| int const x = 1; |
| int added(){ | ||
| int x=1; | ||
| printf("%d",x); | ||
| return x;} No newline at end of file |
There was a problem hiding this comment.
clang-tidy suggestion
| return x;} | |
| return x; | |
| }``` |
Requested by Xianpeng · project thread
Temporary test PR, do not merge. Runs cpp-linter-action
@v2on a fixture with a pure rename, a mode-only change, a file without a final newline and edits to files with unusual names, to compare with the v3 PR opened from the same commit.