Skip to content

Commit

Permalink
fix: return 1 to announce changed files instead of the number of chan…
Browse files Browse the repository at this point in the history
…ged files
  • Loading branch information
Thierry Delafontaine committed Dec 23, 2022
1 parent 676c0ab commit d70c60a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pre_commit_hooks/emacs_vhdl_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main() -> int:
cmd += Config.base_args
cmd.append(lisp_code)

num_files_formatted = 0
return_code = 0
for filename in args.filenames:
with open(filename, "r+") as f:
with subprocess.Popen(
Expand All @@ -57,7 +57,7 @@ def main() -> int:
f.write(formatted_code)
logging.info(f"{filename} successfully formatted")
if file_content != formatted_code:
num_files_formatted += 1
return_code = 1
else:
logging.error(f"{errs}")

Expand All @@ -66,7 +66,7 @@ def main() -> int:
_, errs = proc.communicate()
logging.error(f"Subprocess timed out: {errs}")
return proc.returncode
return num_files_formatted
return return_code


def construct_lisp_code(tab_width: int, custom_eval: str) -> str:
Expand Down

0 comments on commit d70c60a

Please sign in to comment.