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
Wrong token range given for list with trailing comma #1
Comments
It seems like the problem is not limited to just {
1,
} will also reproduce this issue. However, (
1,
) |
Because of gristlabs/asttokens#1, some valid code will generate exceptions for when commas do not need to be added
Thank you for finding the bug and collecting all the details. I'll take a look. |
Could you check out branch 'trailing_commas' to verify if it fixes the problem you found? I think it should also resolve Issue #2. |
The branch seems to fix it! Thanks for the quick resolution and for the great library. |
Excellent! I'll close this issue then. |
Use simpler and more robust tree equality checking instead of astroid as_string
Hello,
Great library! I've been using it to implement this pre-commit hook that ensures trailing commas exist.
Here is a simple repro case to illustrate an issue I'm facing:
This will output
Where the expected result should be
Please note that removing the trailing comma will not reproduce the bug.
This issue is not limited to a single param - as long as there's a trailing comma. The following will produce similar a issue:
and so on
The text was updated successfully, but these errors were encountered: