-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
When a function in source file contains both type annotation comment and docstring, but in wrong order, com2ann fails with SyntaxError
.
Expected behaviour:
- When the type comment is placed after docstring, it should be considered to be a basic inline comment and skipped.
- Com2ann should skip the function and process the rest of the file.
- The comment should be left in place so users can fix it themselves
- Ideally there should an warning in the output informing user there was a function that was skipped due to misplaced type comment.
How to reproduce:
Create file test.py:
class Klass:
def function(self, parameter):
"""Comment"""
# type: (str) -> str
return parameter
Call com2ann: com2ann test.py
Output:
File: test.py
SyntaxError in test.py
Metadata
Metadata
Assignees
Labels
No labels