SKIP_PATTERN(self.lines[err.lnum - 1]): "IndexError: list index out of range" when parsing empty file
grische opened this issue · comments
Grische commented
Starting with version 8.3.4 (or 8.3.5), pylama throws an IndexError when an empty Python file is present in the repository.
Traceback (most recent call last):
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/bin/pylama", line 8, in <module>
sys.exit(shell())
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/lib/python3.7/site-packages/pylama/main.py", line 119, in shell
rootdir=CURDIR,
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/lib/python3.7/site-packages/pylama/main.py", line 68, in check_paths
errors += run(path=path, code=code, rootdir=rootdir, options=options)
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/lib/python3.7/site-packages/pylama/core.py", line 41, in run
ctx.push(source=lname, **err_info)
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/lib/python3.7/site-packages/pylama/context.py", line 107, in __exit__
self.push(lnum=1, col=1, text=str(evalue))
File "/root/.local/share/virtualenvs/testrepo-a7DjncKn/lib/python3.7/site-packages/pylama/context.py", line 184, in push
if SKIP_PATTERN(self.lines[err.lnum - 1]):
IndexError: list index out of range
This can be easily reproduced by creating an empty repository, putting an empty test.py
file into it, and adding the following pylama.ini
:
[pylama]
linters = pydocstyle
Velikiy Prikalel commented
Have the same issue.