Skip to content
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 rust 2 #44

Closed
wants to merge 14 commits into from
Closed

Test rust 2 #44

wants to merge 14 commits into from

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Dec 12, 2024

just comparing

@2bndy5 2bndy5 changed the title Test rust Test rust 2 Dec 12, 2024
Copy link

github-actions bot commented Dec 12, 2024

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v17.0.4) reports: 2 file(s) not formatted
  • src/demo.cpp
  • src/demo.hpp
clang-tidy (v17.0.4) reports: 6 concern(s)
  • src/demo.cpp

    src/demo.cpp:2:1: warning: [misc-include-cleaner]

    included header demo.hpp is not used directly

        2 | #include "demo.hpp"
          | ^~~~~~~~~~~~~~~~~~~
        3 | #include <stdio.h>
  • src/demo.cpp

    src/demo.cpp:3:10: warning: [modernize-deprecated-headers]

    inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead

        3 | #include <stdio.h>
          |          ^~~~~~~~~
          |          <cstdio>
  • src/demo.cpp

    src/demo.cpp:8:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        8 | int main(){
          | ~~~ ^     
          | auto       -> int
  • src/demo.cpp

    src/demo.cpp:10:13: warning: [readability-braces-around-statements]

    statement should be inside braces

       10 |     for (;;) break;
          |             ^      
          |              {
  • src/demo.cpp

    src/demo.cpp:13:5: warning: [cppcoreguidelines-pro-type-vararg]

    do not call c-style vararg functions

       13 |     printf("Hello world!\n");
          |     ^
  • src/demo.hpp

    src/demo.hpp:11:11: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       11 |     void *not_useful(char *str){useless = str;}
          |     ~~~~~~^                    
          |     auto                        -> void *

Have any feedback or feature suggestions? Share it here.

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions bot dismissed their stale review December 12, 2024 17:13

outdated suggestion

github-actions[bot]

This comment was marked as outdated.

@2bndy5 2bndy5 closed this Dec 12, 2024
@2bndy5 2bndy5 reopened this Dec 12, 2024
@github-actions github-actions bot dismissed stale reviews from themself December 12, 2024 20:50

outdated suggestion

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-format v17.0.4

Only 5 out of 7 clang-format concerns 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 1bf553e..86d9f03 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 f93d012..dad4fd6 100644
--- a/src/demo.hpp
+++ b/src/demo.hpp
@@ -3,2 +2,0 @@
-
-
@@ -8,4 +6,8 @@ class Dummy {
-    Dummy() :numb(0), useless("\0"){}
-
-    public:
-    void *not_useful(char *str){useless = str;}
+    Dummy()
+        : numb(0)
+        , useless("\0")
+    {
+    }
+
+public:
+    void* not_useful(char* str) { useless = str; }
@@ -14,19 +16 @@ class Dummy {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-struct LongDiff
-{
+struct LongDiff {
@@ -35 +18,0 @@ struct LongDiff
-

Used clang-tidy v17.0.4

Click here for the full clang-tidy patch
diff --git a/src/demo.cpp b/src/demo.cpp
index 1bf553e..8caf462 100644
--- a/src/demo.cpp
+++ b/src/demo.cpp
@@ -2,2 +2 @@
-#include "demo.hpp"
-#include <stdio.h>
+#include <cstdio>
@@ -4,0 +4,2 @@
+auto main() -> int
+{
@@ -6,6 +7,3 @@
-
-
-int main(){
-
-    for (;;) break;
-
+    for (;;) {
+        break;
+    }
@@ -18 +16,2 @@ int main(){
-    return 0;}
+    return 0;
+}
diff --git a/src/demo.hpp b/src/demo.hpp
index f93d012..1cf7f24 100644
--- a/src/demo.hpp
+++ b/src/demo.hpp
@@ -6,3 +6,3 @@ class Dummy {
-    char* useless;
-    int numb;
-    Dummy() :numb(0), useless("\0"){}
+    char* useless { "\0" };
+    int numb { 0 };
+    Dummy() { }
@@ -10,2 +10,2 @@ class Dummy {
-    public:
-    void *not_useful(char *str){useless = str;}
+public:
+    auto not_useful(char* str) -> void* { useless = str; }

Have any feedback or feature suggestions? Share it here.


// using size_t from cstddef
size_t dummyFunc(size_t i) { return i; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestions

Suggested change
int main()
{

Comment on lines +6 to +11


int main(){

for (;;) break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestions

Suggested change
int main(){
for (;;) break;
for (;;)
break;

clang-tidy diagnostic(s)

Suggested change
int main(){
for (;;) break;
for (;;) {
break;
}

Comment on lines +15 to +18



return 0;}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestions

Suggested change
return 0;}
return 0;
}

Comment on lines 2 to +3
#include "demo.hpp"
#include <cstdio>
#include <cstddef>
#include <stdio.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic(s)

Suggested change
#include "demo.hpp"
#include <cstdio>
#include <cstddef>
#include <stdio.h>
#include <cstdio>

@@ -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>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy suggestion

Suggested change
auto main() -> int
{

int main(){

for (;;) break;


printf("Hello world!\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

src/demo.cpp:13:5 warning: [cppcoreguidelines-pro-type-vararg]

do not call c-style vararg functions

   13 |     printf("Hello world!\n");
      |     ^

Comment on lines +8 to +11
Dummy() :numb(0), useless("\0"){}

public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestions

Suggested change
Dummy() :numb(0), useless("\0"){}
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
Dummy()
: numb(0)
, useless("\0")
{
}
public:
void* not_useful(char* str) { useless = str; }



struct LongDiff
{

long diff;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestions

Please remove the line(s)

  • 35

Comment on lines 6 to +8
char* useless;
int numb;
Dummy() :numb(0), useless("\0"){}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy suggestion

Suggested change
char* useless;
int numb;
Dummy() :numb(0), useless("\0"){}
char* useless { "\0" };
int numb { 0 };
Dummy() { }

Comment on lines 10 to +11
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic(s)

Suggested change
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
public:
auto not_useful(char* str) -> void* { useless = str; }

github-actions[bot]

This comment was marked as duplicate.

@2bndy5 2bndy5 closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant