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

python: Fix for comments starting or ending with double quotes. Fixes #1239 #2654

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nithin-sudarsan
Copy link

#1239

Description

This fix handles both the cases where the comments might or end with a double quote ".

Related Issue

#1239

Motivation and Context

The code earlier was replacing only the ending double quote, but the starting double quote was left unhandled. Moreover, while handling ending double quote, there was no whitespace to separating it at the end.

Previous Behaviour / Output

Same as above 👆

New Behaviour / Output

If the line starts or end with double quote, both the cases are prepended and appended with whitespace accordingly.

@russaa
Copy link

russaa commented Sep 30, 2024

I think, with these changes, it should fix potential issues, when the comment starts with a double-quote too (actually, the problem with the previous implementation would have been, when comment would itself start with three double-quotes).

The escaping of all double-quotes in the comment-string should also take care of cases, when the comment contains three (or more) consecutive double-quotes which would be problematic in python.

so I would say, this should fix any potential issues for invalid comments in python due to double-quotes

(I tested these changes with the input that previously raised the issues with invalid python code for me, and the new output was in fact valid now)

@nithin-sudarsan
Copy link
Author

nithin-sudarsan commented Oct 1, 2024

@russaa thank you for your feedback!
Can you please guide me on how do to get approval from a maintainer in order to complete the above workflow?

@russaa
Copy link

russaa commented Oct 12, 2024

sorry, I don't have any additional insight on how to best contribute to this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants