autoDocstring
autoDocstring copied to clipboard
Remove inline comments during line preprocessing
Looks like the current implementation only removes lines that start with "#" to filter comments. As described in issue #160, inline comments are missed. This should resolve issue #160.
Thank you for opening this PR! Could you add a test to validate that the behavior is correct?
Good thing you asked for a test case, turns out we missed something (see commit message on 100adc3). Should be good now.
Sorry for the massive delay on responding to this. Does this handle strings that have the pound sign in them? e.g. x = "# abc"
So we could possibly limit this to only trim comments in the docstring definition since it is less likely to have a string with a # in it than in the body.
I don't think I realized at the time that hash symbols in strings are possible. I agree with the discussion at #144 that this will be impossible to do exactly right with regex, because it's fundamentally outside of the scope of regular languages. Also, this is really low impact so maybe this should just be a wontfix thing. Maybe there should be a test case addressing this specifically, because I did get all tests to pass.