-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test cpp linter#65 #30
Conversation
should analyze no files given the extensions are not used here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Click here for the full clang-tidy patch
diff --git a/src/demo.cpp b/src/demo.cpp
index fc295c3..b160609 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -3 +3 @@
-#include <stdio.h>
+#include <cstdio>
@@ -4,0 +5,2 @@
+auto main() -> int
+{
@@ -6,6 +8,3 @@
-
-
-int main(){
-
- for (;;) break;
-
+ for (;;) {
+ break;
+ }
@@ -18 +17,2 @@ int main(){
- return 0;}
+ return 0;
+}
diff --git a/src/demo.hpp b/src/demo.hpp
index a429f5c..2591c48 100644
--- a/src/demo.hpp
+++ b/src/demo.hpp
@@ -11 +11 @@ class Dummy {
- void *not_useful(char *str){useless = str;}
+ auto not_useful(char* str) -> void* { useless = str; }
Have any feedback or feature suggestions? Share it here.
@@ -1,17 +1,18 @@ | |||
/** This is a very ugly test code (doomed to fail linting) */ | |||
#include "demo.hpp" | |||
#include <cstdio> | |||
#include <cstddef> | |||
#include <stdio.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [modernize-deprecated-headers]
#include <stdio.h> | |
#include <cstdio> |
|
||
// using size_t from cstddef | ||
size_t dummyFunc(size_t i) { return i; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy suggestions
auto main() -> int | |
{ |
|
||
|
||
int main(){ | ||
|
||
for (;;) break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- use a trailing return type for this function [modernize-use-trailing-return-type]
- statement should be inside braces [readability-braces-around-statements]
int main(){ | |
for (;;) break; | |
for (;;) { | |
break; | |
} |
|
||
|
||
|
||
return 0;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy suggestions
return 0;} | |
return 0; | |
} |
useless = str; | ||
return 0; | ||
} | ||
void *not_useful(char *str){useless = str;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- use a trailing return type for this function [modernize-use-trailing-return-type]
void *not_useful(char *str){useless = str;} | |
auto not_useful(char* str) -> void* { useless = str; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Only 6 out of 7 clang-format suggestions fit within this pull request's diff.
Click here for the full clang-format patch
diff --git a/src/demo.cpp b/src/demo.cpp
index fc295c3..c522998 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -4,0 +5,2 @@
+int main()
+{
@@ -6,6 +8,2 @@
-
-
-int main(){
-
- for (;;) break;
-
+ for (;;)
+ break;
@@ -15,4 +13,2 @@ int main(){
-
-
-
- return 0;}
+ return 0;
+}
diff --git a/src/demo.hpp b/src/demo.hpp
index a429f5c..8f92cac 100644
--- a/src/demo.hpp
+++ b/src/demo.hpp
@@ -8 +8,5 @@ class Dummy {
- Dummy() :numb(0), useless("\0"){}
+ Dummy()
+ : numb(0)
+ , useless("\0")
+ {
+ }
@@ -11 +15 @@ class Dummy {
- void *not_useful(char *str){useless = str;}
+ void* not_useful(char* str) { useless = str; }
@@ -14,17 +17,0 @@ class Dummy {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -34,2 +21 @@ struct LongDiff
- long diff;
-
+ long diff;
Have any feedback or feature suggestions? Share it here.
|
||
// using size_t from cstddef | ||
size_t dummyFunc(size_t i) { return i; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
int main() | |
{ |
|
||
|
||
int main(){ | ||
|
||
for (;;) break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
int main(){ | |
for (;;) break; | |
for (;;) | |
break; |
|
||
|
||
|
||
return 0;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
return 0;} | |
return 0; | |
} |
@@ -5,12 +5,10 @@ | |||
class Dummy { | |||
char* useless; | |||
int numb; | |||
Dummy() :numb(0), useless("\0"){} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
Dummy() :numb(0), useless("\0"){} | |
Dummy() | |
: numb(0) | |
, useless("\0") | |
{ | |
} |
useless = str; | ||
return 0; | ||
} | ||
void *not_useful(char *str){useless = str;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
void *not_useful(char *str){useless = str;} | |
void* not_useful(char* str) { useless = str; } |
long diff; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
long diff; | |
long diff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
No objections from clang-format.
Great job! 🎉
Have any feedback or feature suggestions? Share it here.
tests for cpp-linter/cpp-linter#65