Support directories that end in .py/.pyi
uneos-papr opened this issue · 3 comments
uneos-papr commented
Running pyleft
on a repository tree that contains a folder that ends on .py
, will crash pyleft
.
Traceback (most recent call last):
File "/usr/local/python/current/bin/pyleft", line 8, in <module>
sys.exit(run())
^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/console.py", line 13, in run
all_issues = pyleft.api.main()
^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/api.py", line 182, in main
all_issues.extend(check_file(file))
^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/api.py", line 160, in check_file
file_content = file.read_text(encoding="utf-8").splitlines()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/pathlib.py", line 1058, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/pathlib.py", line 1044, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/workspaces/.../tests/test_routers_document.py'
Results from these patterns here should only be added if they are actual files or symlinks to files
Lines 82 to 83 in 481c6e1
NathanVaughn commented
Thanks for pointing that out, I'll get that fixed this evening.
…On Mon, Jun 12, 2023 at 4:46 AM Pablo Prietz ***@***.***> wrote:
Running pyleft on a repository tree that contains a folder that ends on
.py, will crash pyleft.
Traceback (most recent call last):
File "/usr/local/python/current/bin/pyleft", line 8, in <module>
sys.exit(run())
^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/console.py", line 13, in run
all_issues = pyleft.api.main()
^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/api.py", line 182, in main
all_issues.extend(check_file(file))
^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/site-packages/pyleft/api.py", line 160, in check_file
file_content = file.read_text(encoding="utf-8").splitlines()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/pathlib.py", line 1058, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.3/lib/python3.11/pathlib.py", line 1044, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^IsADirectoryError: [Errno 21] Is a directory: '/workspaces/.../tests/test_routers_document.py'
Results from these patterns here should only be added if they are actual
files or symlinks to files
https://github.com/NathanVaughn/pyleft/blob/481c6e1a4a2f3637f41408ca1d6287dae3c94152/pyleft/settings.py#L82-L83
—
Reply to this email directly, view it on GitHub
<#96>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACB4QK5WE5C2PO4GX6UIC4LXK3QPTANCNFSM6AAAAAAZDDRCJE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
NathanVaughn commented
Fixed in 1.2.2
uneos-papr commented
Thank you for fixing this so quickly!