Skip to content

Commit

Permalink
FIX: Ignore empty __init__.py. Closes #5
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adobki committed Nov 18, 2023
1 parent 3f51cbc commit 55ea56a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions alxcheck/tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand All @@ -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__":
Expand Down

0 comments on commit 55ea56a

Please sign in to comment.