Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Core
- Replace pychalk (not maintained for 7 years) by termcolor
- Update make scripts so they also work on Windows
- Align number columns of markdown tables in reports

- New linters

Expand Down
20 changes: 17 additions & 3 deletions megalinter/utils_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@
ML_REPO_ISSUES_URL,
OX_MARKDOWN_LINK,
)
from pytablewriter import MarkdownTableWriter
from pytablewriter import Align, MarkdownTableWriter
from pytablewriter.style import Style
from redis import Redis


def build_markdown_summary(reporter_self, action_run_url=""):
table_header = ["Descriptor", "Linter", "Files", "Fixed", "Errors", "Warnings"]
table_column_styles = [
Style(align=Align.LEFT),
Style(align=Align.LEFT),
Style(align=Align.RIGHT),
Style(align=Align.RIGHT),
Style(align=Align.RIGHT),
Style(align=Align.RIGHT),
]
if reporter_self.master.show_elapsed_time is True:
table_header += ["Elapsed time"]
table_data_raw = [table_header]
table_column_styles += [Style(align=Align.RIGHT)]
table_data_raw = []
for linter in reporter_self.master.linters:
if linter.is_active is True:
status = (
Expand Down Expand Up @@ -82,7 +92,11 @@ def build_markdown_summary(reporter_self, action_run_url=""):
table_data_raw += [table_line]
# Build markdown table
table_data_raw.pop(0)
writer = MarkdownTableWriter(headers=table_header, value_matrix=table_data_raw)
writer = MarkdownTableWriter(
headers=table_header,
column_styles=table_column_styles,
value_matrix=table_data_raw,
)
table_content = str(writer)
status = (
"✅"
Expand Down