From 55ea56aeddddc489fce755d5052fe8c5f6757ee6 Mon Sep 17 00:00:00 2001 From: Donald Ajaps Date: Sat, 18 Nov 2023 23:16:57 +0100 Subject: [PATCH] FIX: Ignore empty __init__.py. Closes #5 Skips all checks on empty __init__.py files. CHANGES alxcheck/utils/helpers.py + Add is_empty_init_py function helper function for skipping all checks on empty __init__.py. alxcheck/checks/general.py: * Fix typo: Remove trailing S in function name check_file_ends_with_new_line. alxcheck/main.py + Print no_ending_new_line error only if new function returns False * Make Python checks conditional/based on new check's output. --- alxcheck/tests/test_general.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alxcheck/tests/test_general.py b/alxcheck/tests/test_general.py index 8644739..df29c01 100644 --- a/alxcheck/tests/test_general.py +++ b/alxcheck/tests/test_general.py @@ -3,7 +3,7 @@ from ..checks import ( check_file_present, check_file_not_empty, - check_file_ends_with_new_lines, + check_file_ends_with_new_line, ) @@ -26,11 +26,11 @@ def test_readme_not_empty_check(self): def test_files_with_new_line_check(self): f = open("file", "w") f.close() - self.assertFalse(check_file_ends_with_new_lines("file")) + self.assertFalse(check_file_ends_with_new_line("file")) f = open("file", "wb") f.write(b"line\n\n") f.close() - self.assertTrue(check_file_ends_with_new_lines("file")) + self.assertTrue(check_file_ends_with_new_line("file")) if __name__ == "__main__":