-
Notifications
You must be signed in to change notification settings - Fork 190
Fix IndexError on strange backslash docstring #506
Conversation
src/pydocstyle/checker.py
Outdated
if (len(indents) > 1 and min(indents[:-1]) > indent or | ||
indents[-1] > indent): | ||
if ( | ||
len(indents) > 1 and min(indents[:-1]) > indent or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth putting brackets for clarity here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there weren't brackets before, the newline I think is enough to differentiate, I can change it if you insist (or you can push to the PR if you like)
yield violations.D208() | ||
if min(indents) < indent: | ||
if len(indents) > 0 and min(indents) < indent: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace len(indents) > 0
with if indents and....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I wanted this to match the > 1
above for clarity, it looks weirder not doing that -- I can change it if you insist but I felt it better to be consistent
@samj1912 Can you please accept the patch and create new tag? That bug is quite nasty from the user point of view: it prevents upgrading flake8 by crashing with a totally useless exception, one that even prevents us from seeing the file that is causing the issue. The patch seems to work fine. |
Among normal bumping of linters temporary pins down pydocstyle due to recent regression. Related: PyCQA/pydocstyle#506
Among normal bumping of linters temporary pins down pydocstyle due to recent regression. Related: PyCQA/pydocstyle#506
Will release the new version tonight :) |
Released :) |
Thanks for submitting a PR!
Please make sure to check for the following items:
If you've added an error code or changed an error code behavior,
you should probably add or change a test case file under
tests/test_cases/
and addit to the list under
tests/test_definitions.py
.If you've added or changed a command line option,
you should probably add or change a test in
tests/test_integration.py
.Make sure to include the PR number after you open and get one.
Please don't get discouraged as it may take a while to get a review.
Resolves #505