Skip to content

Reformat action thread comments #24

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

Closed
shenxianpeng opened this issue Nov 18, 2022 · 26 comments
Closed

Reformat action thread comments #24

shenxianpeng opened this issue Nov 18, 2022 · 26 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@shenxianpeng
Copy link
Contributor

shenxianpeng commented Nov 18, 2022

The thread comments not looks fancy than other projects:

Maybe we could reformat thread comments, I draft a new one (WIP), and I will continue to update if there is a new idea.

Cpp-Linter Report ⚠️

Some files didn't pass the configured checks.

Check the details

The following files need to be formatted (report from clang-format)

  • demo.hpp
  • demo.cpp

The following files have static analysis errors (report from clang-tidy)

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

use a trailing return type for this function

    void *not_usefull(char *str){
    ~~~~~~^
    auto                         -> void *

demo.hpp:12:16: warning: [modernize-use-nullptr]

use nullptr

        return 0;
               ^
               nullptr

demo.cpp

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

use a trailing return type for this function

int main()
~~~ ^
auto       -> int

demo.cpp:7:13: warning: [readability-braces-around-statements]

statement should be inside braces

    for (;;)
            ^
             {

demo.cpp:11:5: warning: [cppcoreguidelines-pro-type-vararg]

do not call c-style vararg functions

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

Have any feedback or feature suggestions? Share it here.


Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

@shenxianpeng shenxianpeng added the enhancement New feature or request label Nov 18, 2022
@2bndy5
Copy link
Contributor

2bndy5 commented Nov 18, 2022

I have no objections to this.

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 26, 2022

If this is to be shown after successful runs, then I think it would be good to be more concise.

Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

@shenxianpeng
Copy link
Contributor Author

If there are many files that were changed, the old thread comments are too long, see https://github.com/Bliztle/p1-bargain/pull/16

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 30, 2022

Instead of showing the errors, we could show a simple table that summarizes the results.

file clang-tidy clang-format
demo/demo.cpp 🔴 🟢

complete emoji choices

@2bndy5
Copy link
Contributor

2bndy5 commented Nov 30, 2022

Or we could hide the summary table in a details tag

Cpp-Linter Report ⚠️

Some files didn't pass the configured checks.

sumary table
file clang-format clang-tidy
demo/demo.cpp 🟢 🚫
demo/test.cpp 🚫

@shenxianpeng
Copy link
Contributor Author

I like to hide the summary, but if users don't enable both clang-format and clang-tidy how to show it in the table? maybe a separate display is more suitable.

@2bndy5
Copy link
Contributor

2bndy5 commented Dec 1, 2022

if users don't enable both clang-format and clang-tidy how to show it in the table?

I was thinking we could use 🚫 or ⛔ instead of 🔴/🟢. FYI, the longer the emoji code, the less data we can fit in the comment.

maybe a separate display is more suitable.

What did you have in mind?

@shenxianpeng
Copy link
Contributor Author

Sorry for not being clear. I mean if users only have clang-format checks, we do not need to give them clang-tidy related comments, and vice versa.

so I would like to remove clang-tidy from the table or display it like below as an example.

Cpp-Linter Report ⚠️

Some files didn't pass the configured checks.

Check the details

clang-format - the following files need to be formatted

  • demo.hpp
  • demo.cpp

Have any feedback or feature suggestions? Share it here.

@2bndy5
Copy link
Contributor

2bndy5 commented Dec 1, 2022

You know me: anything is possible. I just need a concrete decision before coding the solution.

So, if tidy-checks is '-*' or style is '', then we go with a list. Otherwise we show a table. Yes?

@shenxianpeng
Copy link
Contributor Author

shenxianpeng commented Dec 1, 2022

I'm not sure when clang-tidy reports an error, how can we show it in the table? for example in this one #24 (comment)

@2bndy5
Copy link
Contributor

2bndy5 commented Dec 1, 2022

I only suggested the table because

  1. it will reduce the occupied screen real estate when user expands the details.
  2. not showing the info about the reported errors will allow us to fit more summary info in the comment. Remember that the comment's size is limited by the REST API max payload size, so a thread comment about a very large diff (with lots of errors/warnings to report) will be truncated by the REST API's max payload size. There isn't a way around this max limit. I know other actions hide the ending portion of their potentially large comments in a <details> tag just in case the payload is truncated.

@2bndy5
Copy link
Contributor

2bndy5 commented Dec 1, 2022

One thing I noticed about all the example comments you linked to in the OP was that they all show an overview instead of detailed info. So, I thought that was partly what you wanted to mimic.

@shenxianpeng
Copy link
Contributor Author

shenxianpeng commented Dec 1, 2022

I'm good with only show an overview with table instead of detailed info.

@shenxianpeng
Copy link
Contributor Author

shenxianpeng commented Dec 18, 2022

Cpp-Linter Report ⚠️

Some files didn't pass the configured checks!

clang-format reports: 2 file(s) not formatted

  • demo/demo.cpp
  • demo/test.cpp
clang-tidy reports: 7 warning(s)

  • demo/demo.cpp

    demo/demo.cpp:3:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [modernize-deprecated-headers]
    #include <stdio.h>
             ^~~~~~~~~
             <cstdio>
    demo/demo.cpp:8:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
    int main(){
    ~~~ ^
    auto       -> int
    demo/demo.cpp:10:13: warning: statement should be inside braces [readability-braces-around-statements]
        for (;;) break;
                ^
                 {
    demo/demo.cpp:13:5: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
        printf("Hello world!\n");
        ^
  • demo/demo.hpp

    demo/demo.hpp:6:11: warning: use default member initializer for 'useless' [modernize-use-default-member-init]
        char* useless;
              ^
                     {"\0"}
    demo/demo.hpp:7:9: warning: use default member initializer for 'numb' [modernize-use-default-member-init]
        int numb;
            ^
                {0}
    demo/demo.hpp:11:11: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
        void *not_useful(char *str){useless = str;}
        ~~~~~~^
        auto                        -> void *

Have any feedback or feature suggestions? Share it here.


Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

@shenxianpeng
Copy link
Contributor Author

Finally, I‘ve listed both thread comments in my last comment, I've tried to keep it concise and informative. @2bndy5 any thoughts?

@2bndy5
Copy link
Contributor

2bndy5 commented Dec 28, 2022

LGTM

@2bndy5
Copy link
Contributor

2bndy5 commented Jan 10, 2023

I just found an additional feature in github actions: The GITHUB_STEP_SUMMARY will post a markdown content at the bottom of the run's summary. Its not exactly like thread-comments (the markdown payload is the same), but at least we wouldn't have to worry about duplicate bot comments.

Someone even uses the feature in an existing action that produces a unit test summary comment in the workflow's run summary. For example, this run summary shows the custom summary that we could create.

@shenxianpeng
Copy link
Contributor Author

I like this feature!

@2bndy5
Copy link
Contributor

2bndy5 commented Jan 10, 2023

It wouldn't be too hard to implement, we just need to add an input option to turn it on/off and add

with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as summary:
    summary.write(Globals.OUTPUT)

@shenxianpeng
Copy link
Contributor Author

I have tried to add a job summary here, and it's relatively easier to implement.

@2bndy5
Copy link
Contributor

2bndy5 commented Feb 18, 2023

Yep! We don't have to check for duplicate comments and all that entails either.

@stale
Copy link

stale bot commented Apr 1, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 1, 2023
@2bndy5
Copy link
Contributor

2bndy5 commented Apr 1, 2023

sorry this still on my todo list, but I've been busy.

@stale stale bot removed the wontfix This will not be worked on label Apr 1, 2023
@stale
Copy link

stale bot commented May 1, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@2bndy5
Copy link
Contributor

2bndy5 commented May 19, 2023

Note

I recently noticed that github added support for admonitions (AKA "callouts"). See example here.

Warning

But it looks like only "note" and "warning" are supported (in English only). I also don't like how this looks in dark mode. Block quotes' dimmed text was a bad choice.

@2bndy5 2bndy5 closed this as completed in 5977c76 May 20, 2023
@shenxianpeng
Copy link
Contributor Author

I don't know this before, looks like not too bad, tks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants