PyCQA / pydocstyle

docstring style checker
http://pydocstyle.org
MIT License
1.11k stars 189 forks source link

IndexError on one-line backslash docstring #505

Closed asottile closed 4 years ago

asottile commented 4 years ago
def f():
    """a\
"""
$ pydocstyle --version
5.1.0
$ pydocstyle t.py 
Traceback (most recent call last):
  File "/tmp/x/venv/bin/pydocstyle", line 8, in <module>
    sys.exit(main())
  File "/tmp/x/venv/lib/python3.8/site-packages/pydocstyle/cli.py", line 68, in main
    sys.exit(run_pydocstyle())
  File "/tmp/x/venv/lib/python3.8/site-packages/pydocstyle/cli.py", line 44, in run_pydocstyle
    errors.extend(check((filename,), select=checked_codes,
  File "/tmp/x/venv/lib/python3.8/site-packages/pydocstyle/checker.py", line 979, in check
    for error in ConventionChecker().check_source(source, filename,
  File "/tmp/x/venv/lib/python3.8/site-packages/pydocstyle/checker.py", line 123, in check_source
    for error in errors:
  File "/tmp/x/venv/lib/python3.8/site-packages/pydocstyle/checker.py", line 288, in check_indent
    indents[-1] > indent):
IndexError: list index out of range
chetan009 commented 4 years ago

I have found this issue using flake8 as precommit test and these are version details of each flake8 package. `pydocstyle==5.1.0 flake8-bugbear==20.1.4 flake8-docstrings==1.5.0 flake8-rst==0.7.2 flake8-rst-docstrings==0.0.13

`