Skip to content
Open
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
9 changes: 9 additions & 0 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@
report.write(f"## {label[10:]}\n\n")
for content in issue_dict[label]:
report.write(content.replace("\r\n", "\n"))

with open("severity_counts.sh", "w") as counts_file:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you miss committing this file here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume you have a bash script to replace summary.tex. An alternate approach is the following, split the file summary.tex into summary.tex and summary_table.tex.

Where summary.tex would include summary_table.tex. This script can directly generate summary_table.tex.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I saw no need to commit the file because the script creates it from scratch. I tried to keep the repo as clean as possible.

I added a few lines in report-template's generate.sh file to load the vars set in severity_counts.sh and then replace some placeholders in the file. It doesn't replace the whole file. I'll take a look at this new summary_table.tex approach later.

All this should be temporary. I was trying to think about a more automated solution that doesn't require copying/moving files between folders.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

automated solution that doesn't require copying/moving files between folders.

Good idea. This is probably better. To give context, this script (compile-issues) came later. Initially, we were just writing everything in hackmd. Now, we just moved everything to GitHub.

total_count = 0
for label in SEVERITY_LABELS:
variable_name = label[10:].upper().replace(" ", "_") + "_COUNT="
count = len(issue_dict[label])

@hrkrshnn hrkrshnn Mar 7, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If label does not exist in issue_dict, this would throw, right? Can you add a check for this?

counts_file.write(variable_name + str(count) + '\n')
total_count += count
counts_file.write('TOTAL_RISK_COUNT=' + str(total_count) + '\n')