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

Missing summary table in Github pull request comment #1640

Closed
hmG3 opened this issue Jul 23, 2022 · 1 comment · Fixed by #1650
Closed

Missing summary table in Github pull request comment #1640

hmG3 opened this issue Jul 23, 2022 · 1 comment · Fixed by #1650
Labels
bug Something isn't working

Comments

@hmG3
Copy link
Contributor

hmG3 commented Jul 23, 2022

Describe the bug
Github Comment Reporter doesn't render a summary markdown table as a PR comment if only one linter is enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Enable only one linter in the config file (for me it was RUBY_RUBOCOP but the actual linter doesn't matter)
  2. Perform Megalinter run in Github Actions (flavor image doesn't matter) for a PR, so it finishes and prints the summary table in the console via Console Reporter. Notice the comment: [GitHub Comment Reporter] Posted summary as a comment on company/project #PR1
  3. Navigate to the PR and see missing table in PR comment, despite the table exists in the console

Expected behavior
Github Comment Reporter should render the summary table for any number of enabled linters and any execution status.

Screenshots
chrome_5QkChXNAH1
chrome_fixNJ1MEwP

Additional context
After investigating and debugging the current main branch, I found how the table should be generated. However the next line

table_content = str(writer) + os.linesep if len(table_data_raw) > 1 else ""
apparently has unexpected behavior in else case. If one linter is enabled, it overwrites the whole table content with empty string and thus we have the missing table. I tried to wrap os.linesep + if-else block in parentheses or even remove it - in both cases, it began to work as expected.

@hmG3 hmG3 added the bug Something isn't working label Jul 23, 2022
@Kurt-von-Laven
Copy link
Collaborator

Sounds like you already got it working, so if you are willing to open a pull request with your changes, that would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants