Skip to content

Commit

Permalink
update all based on verison 18
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahannali committed Dec 19, 2024
1 parent 65d5a21 commit 3f1de45
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,24 @@ def run_linters():
output_dir.mkdir(exist_ok=True)
output_file = "output.txt"

# if os.path.exists(output_file):
# os.remove(output_file)
if os.path.exists(output_file):
os.remove(output_file)

try:
# todo: add to reviewdog config instead --conf={github_action_path}/.reviewdog.yml
# todo: add to reviewdog config instead
linters = ['mypy', 'pylint']
for i, linter in enumerate(linters):
for linter in linters:
save_file = f"sarif_output_{linter}.json"

subprocess.run(
f'{linter} testing.py | reviewdog -reporter=sarif -runners={linter} --name={linter} > {save_file}',
f'{linter} | reviewdog -reporter=sarif -runners={linter} --name={linter} --conf={github_action_path}/.reviewdog.yml > {save_file}',
shell=True,
stderr=subprocess.PIPE,
check=True,
)

with open(save_file, "r") as tool_output:
with open(output_file, "w") as file:
file.write(f"LINTER OUTPUT: {linter}")
file.write("\n")
with open(output_file, "a") as file:
file.write(commit_hash)
file.write("\n")
file.write(repo_name)
Expand All @@ -65,4 +63,4 @@ def run_linters():
print(f"Error output: {e.stderr.decode()}")

if __name__ == "__main__":
run_linters()
run_linters()

0 comments on commit 3f1de45

Please sign in to comment.