Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKIP_PATTERN(self.lines[err.lnum - 1]): "IndexError: list index out of range" when parsing empty file #214

Open
grische opened this issue Feb 16, 2022 · 1 comment

Comments

@grische
Copy link

grische commented Feb 16, 2022

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
@Prikalel
Copy link

Have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants