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 pr reviews (attempt 2) #27

Closed
wants to merge 5 commits into from
Closed

Test pr reviews (attempt 2) #27

wants to merge 5 commits into from

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Jan 6, 2024

No description provided.

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions bot dismissed their stale review January 7, 2024 23:15

outdated suggestion

@2bndy5 2bndy5 marked this pull request as ready for review January 7, 2024 23:31
github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions bot dismissed their stale review January 8, 2024 00:26

outdated suggestion

github-actions[bot]

This comment was marked as resolved.

@github-actions github-actions bot dismissed their stale review January 8, 2024 01:15

outdated suggestion

github-actions[bot]

This comment was marked as duplicate.

@shenxianpeng
Copy link
Collaborator

The PR review tests look great! I like the commit suggestions

@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Jan 8, 2024

If the github-actions bot can be the cpp-linter bot that would be nice. not sure if we could have our own bot. (I remember we had some discussions in the past, to have a bot should need to create GitHub app)

@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Jan 8, 2024

If the github-actions bot can be the cpp-linter bot that would be nice

If having a bot is easy, having one of own is certainly nice. It's not necessary to have our bot, and that's fine for now.

@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Jan 8, 2024

An example not need to create GitHub App, like Ansible, they create an account called ansibot https://github.com/ansibot to backport and add labels in PR ansible/ansible#82488

Update: The ansibot account is only for updating ansible projects, if you need to update other projects that don't belong to ansible, you need to grant permissions, so this kind of account is not suitable for us.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Jan 8, 2024

It uses the "GitHub-actions" bot because this workflow uses secrets.GITHUB_TOKEN. I could set it to a secret token specific to cpp-linter org and it would use that account as the bot name.

On the plus side, this means that anyone can use a personal access token to make the thread comments and PR reviews look like they are coming from the user account associated with the personal access token:

- uses: cpp-linter/cpp-linter-action@v2
  env:
    # make comment and reviews look like I posted them
    GITHUB_TOKEN: ${{ secrets.2bndy5_PERSONAL_TOKEN }}
  with:
    tidy-review: true
    lines-changed-only: true

A few days ago, I looked into setting up a cpp-linter app (yet again) by following all the docs I found. I stopped when it said that the authenticating tokens need to be refreshed on the server that is hosting the app (which doesn't need to be a web app anymore).

We could look into this more, but I don't have the funding to pay for server space. And I'm not willing to expose a server on my home network for that either.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Jan 8, 2024

Also, I am finally happy with how the review comments are looking!

I still want to look at automatically removing old reviews' comments...

  1. There is no way to "hide" comments with the REST API
  2. Dismissing a review doesn't auto-hide the comments from the thread.
  3. Each review comment is tied to the commit that triggered the review.

I don't like the idea of using 1 review for all review comments because

  • It would be harder to keep outdated comments updated if the file contents change since the comment was first created.
  • Altering/deleting a review comment's body of text (disregarding the last point) may confuse any user responses/discussion following that comment. I think the review comments made should be considered immutable for this reason.
  • Once a review is marked as REQUESTED_CHANGES, it cannot be changed to APPROVED.

All of these considerations could mean the PR review feature might be seen as spam. So, I disabled the feature when the PR in question is marked as a "draft". I still have to do the same for closed PRs.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Jan 8, 2024

anyone can use a personal access token to make the thread comments and PR reviews look like they are coming from the user account associated with the personal access token

I need to stop looking for thread comments that are specifically created by the github-actions bot for this reason. The thread-comments feature currently assumes that users are specifying the secrets.GITHUB_TOKEN instead of a user account's personal token.

EDIT: see cpp-linter/cpp-linter#53

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

Only 5 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..31566a5 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
-
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..115b0de 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; }

Copy link

@github-actions github-actions bot Jan 8, 2024

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;

Copy link

@github-actions github-actions bot Jan 8, 2024

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;

Comment on lines +15 to +18



return 0;}
Copy link

@github-actions github-actions bot Jan 8, 2024

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 +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;}
Copy link

@github-actions github-actions bot Jan 8, 2024

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;

Copy link

@github-actions github-actions bot Jan 8, 2024

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


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

Copy link

@github-actions github-actions bot Jan 8, 2024

Choose a reason for hiding this comment

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

clang-tidy suggestions

Suggested change
auto main() -> int
{

Comment on lines +6 to +11


int main(){

for (;;) break;

Copy link

@github-actions github-actions bot Jan 8, 2024

Choose a reason for hiding this comment

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

clang-tidy diagnostics

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




return 0;}
Copy link

@github-actions github-actions bot Jan 8, 2024

Choose a reason for hiding this comment

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

clang-tidy suggestions

Suggested change
return 0;}
return 0;
}

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

@github-actions github-actions bot Jan 8, 2024

Choose a reason for hiding this comment

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

clang-tidy diagnostics

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;}
Copy link

@github-actions github-actions bot Jan 8, 2024

Choose a reason for hiding this comment

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

clang-tidy diagnostics

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; }

should analyze no files given the extensions are not used here
@github-actions github-actions bot dismissed their stale review January 9, 2024 21:44

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

No objections from clang-format.
No objections from clang-tidy.

Great job!

Have any feedback or feature suggestions? Share it here.

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.

2 participants