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

Templates using CRLF newlines cause extra returns and white spaces #198

Open
justinchuby opened this issue Aug 21, 2021 · 0 comments · May be fixed by #199
Open

Templates using CRLF newlines cause extra returns and white spaces #198

justinchuby opened this issue Aug 21, 2021 · 0 comments · May be fixed by #199
Labels

Comments

@justinchuby
Copy link

Describe the bug

When a custom template is using CRLF newlines (typical in Windows), the generated docstring would contain extra line returns and trailing white spaces.

I copied the exact google template from the source as a custom template. When I saved the template file with LF newlines, the behavior was expected. When the template was saved with CRLF, the output is what's below.

Versions (please complete the following information):

  • autoDocstring Version: v0.5.4
  • Operating System: Windows 11
  • Vscode Version: 1.59.1

Original Code (with line to generate on):

def foo(param1, param2: str, param3: Optional[str]=None):
# generate on this line
    pass

Expected Result:

def foo(param1, param2: str, param3: Optional[str]=None) -> str:
    """[summary]

    Args:
        param1 ([type]): [description]
        param2 (str): [description]
        param3 (Optional[str], optional): [description]. Defaults to None.

    Returns:
        str: [description]
    """
    pass

Actual Result:

def foo(param1, param2: str, param3: Optional[str]=None) -> str:
    """[summary]
    
    
    
    Args:
        param1 ([type]): [description]
        param2 (str): [description]
        param3 (Optional[str], optional): [description]. Defaults to None.
    
    
    Returns:
        str: [description]
    
    """
    pass

Note the trailing white spaces in the new lines.

Stack trace:
If an error was reported by autodocstring please copy the stack trace from the autoDocstring output channel.

N/A

Additional context
Add any other context about the problem here.

@justinchuby justinchuby linked a pull request Aug 21, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant