From 3e77b451b5a351f8d8522f8968c81de060855f19 Mon Sep 17 00:00:00 2001 From: Emmanuel Nwafor Date: Mon, 29 Jan 2024 13:01:10 +0100 Subject: [PATCH] fix: Fix logic for trailing newline check --- alxcheck/checks/general.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alxcheck/checks/general.py b/alxcheck/checks/general.py index 78d4fca..6416444 100644 --- a/alxcheck/checks/general.py +++ b/alxcheck/checks/general.py @@ -19,5 +19,5 @@ def check_file_ends_with_new_line(file_path): if not check_file_not_empty(file_path): return False - with open(file_path, "rb") as f: - return f.readlines()[-1] == b"\n" + with open(file_path, "r") as f: + return f.readlines()[-1][-1] == "\n"