From 0681ed9087ca13524da6e422b4c5e854ea2d69df Mon Sep 17 00:00:00 2001 From: Robin <167366979+allrob23@users.noreply.github.com> Date: Mon, 21 Apr 2025 14:21:25 -0400 Subject: [PATCH] refactor: use with statement for file reading --- tools/validate_whitespace.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/validate_whitespace.py b/tools/validate_whitespace.py index 6c11d256f0..2fb2a082d1 100755 --- a/tools/validate_whitespace.py +++ b/tools/validate_whitespace.py @@ -71,7 +71,8 @@ def main(): if f in ignores: n_skipped += 1 continue - data = open(f, "rb").read() + with open(f, "rb") as file: + data = file.read() error = False for msg in validate_contents(data): print(f"{f}:{msg}")