Skip to content

Commit

Permalink
update write logic for file
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahannali committed Dec 19, 2024
1 parent 735b1a7 commit e31287f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run_linters():
try:
# todo: add to reviewdog config instead --conf={github_action_path}/.reviewdog.yml
linters = ['mypy', 'pylint']
for linter in linters:
for i, linter in enumerate(linters):
save_file = f"sarif_output_{linter}.json"

subprocess.run(
Expand All @@ -41,7 +41,7 @@ def run_linters():
)

with open(save_file, "r") as tool_output:
with open(output_file, "a") as file:
with open(output_file, "w" if i == 0 else "a") as file:
file.write(f"LINTER OUTPUT: {linter}")
file.write("\n")
file.write(commit_hash)
Expand Down
4 changes: 2 additions & 2 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LINTER OUTPUT: mypy
53d99f2bb8b0e66d7c45ec34c3bec47e0ac3a316
735b1a713b75192e6bb7c01b4f55f7ce16ceb249
signals-action
{
"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
Expand Down Expand Up @@ -53,7 +53,7 @@ signals-action
"version": "2.1.0"
}
LINTER OUTPUT: pylint
53d99f2bb8b0e66d7c45ec34c3bec47e0ac3a316
735b1a713b75192e6bb7c01b4f55f7ce16ceb249
signals-action
{
"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
Expand Down

0 comments on commit e31287f

Please sign in to comment.