Skip to content

Commit

Permalink
bugfix: check on newline
Browse files Browse the repository at this point in the history
  • Loading branch information
samdoghor committed Nov 30, 2023
1 parent aa0ede7 commit 410d864
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions alxcheck/checks/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ def check_file_not_empty(file_path):
def check_file_ends_with_new_line(file_path):
if not check_file_not_empty(file_path):
return False
with open(file_path, "r") as f:
return f.read()[-1] == "\n"

with open(file_path, "rb") as f:
return f.readlines()[-1] == b"\n"

0 comments on commit 410d864

Please sign in to comment.