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

🪲 Improve unquoted error text #5688

Merged
merged 4 commits into from
Aug 9, 2024
Merged

🪲 Improve unquoted error text #5688

merged 4 commits into from
Aug 9, 2024

Conversation

boryanagoncharenko
Copy link
Collaborator

Fixes #3444
This PR changes the text of the unquoted error to display only the segments which are not quoted correctly. Also, it removes the incorrectly doubled backslashes.

How to test
In level 6 run the following command:

print 'This is ' unquoted ' and '

The error message should only mention the word unquoted and not the parts which are correctly quoted.

Again, in level 6 execute the following command:

print '5 divided by 5 is ' 5 \ 5

Ensure that the error message points only to the 5 \ 5 part and that the message contains a single backslash (exactly as it appears in the code editor).

Copy link
Member

@jpelay jpelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

return len(s) > 1 and s[0] in supported_quotes and s[-1] in supported_quotes[s[0]]


def find_unquoted_segments(s):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I love this.

Copy link
Contributor

mergify bot commented Aug 9, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Aug 9, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Aug 9, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f3b5950 into main Aug 9, 2024
12 checks passed
@mergify mergify bot deleted the unquoted_error_3444 branch August 9, 2024 11:27
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.

[BUG] Incorrect error message when an unquoted backslash is found in a print statement
2 participants