Repository navigation
[DO NOT MERGE] test cpp-linter-action#501 (cpp-linter 1.15.0) - #64
shenxianpeng wants to merge 6 commits into
Conversation
Cpp-Linter Report
|
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v20.1.2
Only 3 out of 7 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/src/demo.cpp b/src/demo.cpp
index 3fb4fe1..591356e 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -7 +7 @@
-size_t dummyFunc(size_t i) { return i; }
+static auto dummyFunc(size_t i) -> size_t { return i; }
@@ -9 +9 @@ size_t dummyFunc(size_t i) { return i; }
-int main()
+auto main() -> int
@@ -11 +11 @@ int main()
- for (;;)
+ for (;;) {
@@ -12,0 +13 @@ int main()
+ }
@@ -20,3 +21,6 @@ int main()
-int addNumbers( int a,int b ){
- int* unused = NULL;
- if(a>b) return a+b;
+static auto addNumbers(int a, int b) -> int
+{
+ int* unused = nullptr;
+ if (a > b) {
+ return a + b;
+ }
Used clang-format v20.1.2
Click here for the full clang-format patch
diff --git a/src/demo.cpp b/src/demo.cpp
index 3fb4fe1..5b35f1e 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -3 +2,0 @@
-#include <cstdio>
@@ -4,0 +4 @@
+#include <cstdio>
@@ -20 +20,2 @@ int main()
-int addNumbers( int a,int b ){
+int addNumbers(int a, int b)
+{
@@ -22,2 +23,3 @@ int addNumbers( int a,int b ){
- if(a>b) return a+b;
- return b+a ;
+ if (a > b)
+ return a + b;
+ return b + a;
✨ Powered by cpp-linter -- ⭐ Star • ❤️ Sponsor • 💬 Feedback
| #include <cstdio> | ||
|
|
||
| // using size_t from cstddef | ||
| size_t dummyFunc(size_t i) { return i; } |
There was a problem hiding this comment.
clang-tidy diagnostics
- function 'dummyFunc' 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]
| size_t dummyFunc(size_t i) { return i; } | |
| static auto dummyFunc(size_t i) -> size_t { return i; } |
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v20.1.2
Only 4 out of 9 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/src/demo.cpp b/src/demo.cpp
index 5b35f1e..9eb4de6 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -7 +7 @@
-size_t dummyFunc(size_t i) { return i; }
+static auto dummyFunc(size_t i) -> size_t { return i; }
@@ -9 +9 @@ size_t dummyFunc(size_t i) { return i; }
-int main()
+auto main() -> int
@@ -11 +11 @@ int main()
- for (;;)
+ for (;;) {
@@ -12,0 +13 @@ int main()
+ }
@@ -20 +21 @@ int main()
-int addNumbers(int a, int b)
+static auto addNumbers(int a, int b) -> int
@@ -22,2 +23,2 @@ int addNumbers(int a, int b)
- int* unused = NULL;
- if (a > b)
+ int* unused = nullptr;
+ if (a > b) {
@@ -24,0 +26 @@ int addNumbers(int a, int b)
+ }
Used clang-format v20.1.2
No concerns from clang-format.
1 review comment(s) from a previous review were reused (not posted again).
✨ Powered by cpp-linter -- ⭐ Star • ❤️ Sponsor • 💬 Feedback
| } | ||
|
|
||
| // added to test cpp-linter-action#501 (temporary) | ||
| int addNumbers(int a, int b) |
There was a problem hiding this comment.
clang-tidy diagnostics
- function 'addNumbers' 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 addNumbers(int a, int b) | |
| static auto addNumbers(int a, int b) -> int |
clang-tidy diagnostic
src/demo.cpp:20:20: warning: [readability-identifier-length]
parameter name 'a' is too short, expected at least 3 characters
20 | int addNumbers(int a, int b)
| ^clang-tidy diagnostic
src/demo.cpp:20:27: warning: [readability-identifier-length]
parameter name 'b' is too short, expected at least 3 characters
20 | int addNumbers(int a, int b)
| ^| int* unused = NULL; | ||
| if (a > b) |
There was a problem hiding this comment.
clang-tidy diagnostics
- use nullptr [modernize-use-nullptr]
- statement should be inside braces [readability-braces-around-statements]
| int* unused = NULL; | |
| if (a > b) | |
| int* unused = nullptr; | |
| if (a > b) { |
| if (a > b) | ||
| return a + b; | ||
| return b + a; | ||
| } |
There was a problem hiding this comment.
clang-tidy suggestion
| } | |
| } |
There was a problem hiding this comment.
Uhm, what? The indentation seems correct before the suggestion
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v20.1.2
Only 5 out of 10 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/src/demo.cpp b/src/demo.cpp
index ff7f875..aaa18f3 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -7 +7 @@
-size_t dummyFunc(size_t i) { return i; }
+static auto dummyFunc(size_t i) -> size_t { return i; }
@@ -9 +9 @@ size_t dummyFunc(size_t i) { return i; }
-int main()
+auto main() -> int
@@ -11 +11 @@ int main()
- for (;;)
+ for (;;) {
@@ -12,0 +13 @@ int main()
+ }
@@ -20 +21 @@ int main()
-int addNumbers(int a, int b)
+static auto addNumbers(int a, int b) -> int
@@ -22,2 +23,2 @@ int addNumbers(int a, int b)
- int* unused = NULL;
- if (a > b)
+ int* unused = nullptr;
+ if (a > b) {
@@ -24,0 +26 @@ int addNumbers(int a, int b)
+ }
@@ -29 +31 @@ int addNumbers(int a, int b)
-int subtract( int x,int y ){ return x-y ; }
+static auto subtract(int x, int y) -> int { return x - y; }
Used clang-format v20.1.2
Click here for the full clang-format patch
diff --git a/src/demo.cpp b/src/demo.cpp
index ff7f875..d177457 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -29 +29 @@ int addNumbers(int a, int b)
-int subtract( int x,int y ){ return x-y ; }
+int subtract(int x, int y) { return x - y; }
4 review comment(s) from a previous review were reused (not posted again).
✨ Powered by cpp-linter -- ⭐ Star • ❤️ Sponsor • 💬 Feedback
| } | ||
|
|
||
| // second round (temporary) | ||
| int subtract( int x,int y ){ return x-y ; } |
There was a problem hiding this comment.
clang-format suggestion
| int subtract( int x,int y ){ return x-y ; } | |
| int subtract(int x, int y) { return x - y; } |
clang-tidy diagnostics
- function 'subtract' 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 subtract( int x,int y ){ return x-y ; } | |
| static auto subtract(int x, int y) -> int { return x - y; } |
|
Yikes. These clang-format suggestions are useless (here, here, and here). We shouldn't see that in the current v2-RC because clang-format fixes are not gotten from the clang-format's xml output (like in v1.15). Instead, the clang-format fixes are applied directly to cache and the suggestions come from the diff between the fixed cache and the original source. |
Temporary PR to run cpp-linter/cpp-linter-action#501 (cpp-linter 1.14.1 -> 1.15.0) end to end before it is merged. It will be closed after the test.
Runs the action at the #501 head on Linux x64/arm64, macOS, Windows x64/arm64, with thread comments, tidy and format reviews, annotations, step summary and auto-fix, next to a baseline run of the action's main branch.
Generated by Claude Code