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

fix[ux]: empty hint #4351

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sandbubbles
Copy link
Collaborator

What I did

Remove empty hint message from exceptions. As in #4313.

How I did it

Modify the check of absent hint to include an empty string.

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@sandbubbles
Copy link
Collaborator Author

UndeclaredException is the only place where I encountered empty hints. An alternative solution is to add the check there to prevent the hint from being an empty string in the first place.

@charles-cooper
Copy link
Member

It seems like a code smell that we are creating empty string hints in the first place. Do we know where they are coming from?

@sandbubbles
Copy link
Collaborator Author

It seems like a code smell that we are creating empty string hints in the first place. Do we know where they are coming from?

I think its as in this - #4351 (comment) - just the UndeclaredException. But I can spend some more time if i encounter it elsewhere.

@charles-cooper
Copy link
Member

note the regression comes from #4154 -- the previous code checked for truthy value of self.hint.

@sandbubbles
Copy link
Collaborator Author

sandbubbles commented Nov 7, 2024

note the regression comes from #4154 -- the previous code checked for truthy value of self.hint.

Yeah, I think there are two main solutions:

  1. Have the check in the same way as pre fix[ux]: empty hint #4351 - (which is proposed in this PR, because i though hint can be only None or string, but I can rewrite it to if not hint to keep the truthyness).
  2. Or keep the current test if hint is None and modify get_levenshtein_error_suggestions to return None instead of an empty string (which is used as the hint in one type of UndeclaredDefinition)

I think the second solution is cleaner, but the first solution ensures that we catch any missed empty string hints.
What do you prefer?

@charles-cooper
Copy link
Member

i think 2. is better -- we should not be supplying empty string as a hint!

@sandbubbles
Copy link
Collaborator Author

i think 2. is better -- we should not be supplying empty string as a hint!

Hope its better now :)

@sandbubbles sandbubbles marked this pull request as ready for review November 9, 2024 09:55
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