Make linter print useful output when failing on precommit

* Make linter print useful output when failing on precommit

* Update Scripts/precommit.py

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
This commit is contained in:
Harry 2022-10-31 14:05:27 -07:00 committed by GitHub
parent 3bf5b8ed10
commit e90639bcab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,12 +257,17 @@ def lint_swift_files(file_paths: set[str]) -> None:
lint_output = error.output
print(lint_output)
lint_output = subprocess.check_output(
["swiftlint", "lint", "--strict", "--use-script-input-files"],
env=env,
text=True,
)
print(lint_output)
try:
lint_output = subprocess.check_output(
["swiftlint", "lint", "--strict", "--use-script-input-files"],
env=env,
text=True,
)
print(lint_output)
except subprocess.CalledProcessError as error:
print(error.output)
print("Please fix the above lint errors before committing your changes")
sys.exit(1)
def check_diff_for_keywords():