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

Exception in case file lacks newline at end of file #321

Closed
languitar opened this issue Jun 8, 2018 · 1 comment
Closed

Exception in case file lacks newline at end of file #321

languitar opened this issue Jun 8, 2018 · 1 comment

Comments

@languitar
Copy link

@languitar languitar commented Jun 8, 2018

Attached is a file that makes pydocstyle crash because it lacks a trailing newline.

Traceback (most recent call last):
  File "/home/languitar/src/autosuspend/.tox/check/bin/pydocstyle", line 11, in <module>
    sys.exit(main())
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/cli.py", line 68, in main
    sys.exit(run_pydocstyle())
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/cli.py", line 45, in run_pydocstyle
    ignore_decorators=ignore_decorators))
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/checker.py", line 703, in check
    ignore_decorators):
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/checker.py", line 64, in check_source
    module = parse(StringIO(source), filename)
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/parser.py", line 305, in __call__
    return self.parse(*args, **kwargs)
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/parser.py", line 300, in parse
    return self.parse_module()
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/parser.py", line 451, in parse_module
    children = list(self.parse_definitions(Module, all=True))
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/parser.py", line 401, in parse_definitions
    yield self.parse_definition(class_._nest(self.current.value))
  File "/home/languitar/src/autosuspend/.tox/check/lib/python3.6/site-packages/pydocstyle/parser.py", line 513, in parse_definition
    class_.__name__, name, self.current.kind,
AttributeError: 'NoneType' object has no attribute 'kind'

test.py.txt

shacharoo added a commit to shacharoo/pydocstyle that referenced this issue Oct 14, 2018
Nurdok added a commit that referenced this issue Oct 14, 2018
* #321 - fix newline exception bug

* docs
@shacharoo

This comment has been minimized.

Copy link
Member

@shacharoo shacharoo commented Oct 14, 2018

Fixed by #336. Thanks!

@shacharoo shacharoo closed this Oct 14, 2018
@shacharoo shacharoo added this to To do in Pydocstyle 2.2.0 via automation Oct 14, 2018
@shacharoo shacharoo moved this from To do to Done in Pydocstyle 2.2.0 Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.